From f2506433856c53dda07f623dfcfc89ee5132daee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 29 Jan 2019 02:26:39 +0100 Subject: [PATCH] style: Use space after catch We are currently inconsistent with whether or not to put a space after catch clauses. While the predominant style is to omit it, that's inconsistent with the style we use for any other statement. There's not really a good reason to stick with it, so switch to the style gjs/eslint default to. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/607 --- js/gdm/fingerprint.js | 2 +- js/gdm/util.js | 8 ++++---- js/misc/extensionUtils.js | 2 +- js/misc/ibusManager.js | 4 ++-- js/misc/loginManager.js | 4 ++-- js/misc/objectManager.js | 4 ++-- js/misc/util.js | 2 +- js/misc/weather.js | 2 +- js/ui/appDisplay.js | 4 ++-- js/ui/audioDeviceSelection.js | 2 +- js/ui/calendar.js | 2 +- js/ui/components/networkAgent.js | 14 +++++++------- js/ui/components/polkitAgent.js | 4 ++-- js/ui/components/telepathyClient.js | 2 +- js/ui/endSessionDialog.js | 4 ++-- js/ui/environment.js | 2 +- js/ui/extensionDownloader.js | 4 ++-- js/ui/extensionSystem.js | 14 +++++++------- js/ui/ibusCandidatePopup.js | 2 +- js/ui/magnifier.js | 4 ++-- js/ui/notificationDaemon.js | 4 ++-- js/ui/remoteSearch.js | 8 ++++---- js/ui/sessionMode.js | 2 +- js/ui/status/keyboard.js | 2 +- js/ui/status/network.js | 2 +- js/ui/status/thunderbolt.js | 2 +- 26 files changed, 53 insertions(+), 53 deletions(-) diff --git a/js/gdm/fingerprint.js b/js/gdm/fingerprint.js index 5bf2becd5..e27c7c1b1 100644 --- a/js/gdm/fingerprint.js +++ b/js/gdm/fingerprint.js @@ -23,7 +23,7 @@ function FprintManager() { try { self.init(null); - } catch(e) { + } catch (e) { log('Failed to connect to Fprint service: ' + e.message); return null; } diff --git a/js/gdm/util.js b/js/gdm/util.js index 2e9935250..95f2e92e5 100644 --- a/js/gdm/util.js +++ b/js/gdm/util.js @@ -342,7 +342,7 @@ var ShellUserVerifier = class { try { this._clearUserVerifier(); this._userVerifier = client.open_reauthentication_channel_finish(result); - } catch(e) { + } catch (e) { if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) return; if (e.matches(Gio.DBusError, Gio.DBusError.ACCESS_DENIED) && @@ -369,7 +369,7 @@ var ShellUserVerifier = class { try { this._clearUserVerifier(); this._userVerifier = client.get_user_verifier_finish(result); - } catch(e) { + } catch (e) { if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) return; this._reportInitError('Failed to obtain user verifier', e); @@ -429,7 +429,7 @@ var ShellUserVerifier = class { (obj, result) => { try { obj.call_begin_verification_for_user_finish(result); - } catch(e) { + } catch (e) { if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) return; this._reportInitError('Failed to start verification for user', e); @@ -444,7 +444,7 @@ var ShellUserVerifier = class { (obj, result) => { try { obj.call_begin_verification_finish(result); - } catch(e) { + } catch (e) { if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) return; this._reportInitError('Failed to start verification', e); diff --git a/js/misc/extensionUtils.js b/js/misc/extensionUtils.js index 51272e49c..908f9fd38 100644 --- a/js/misc/extensionUtils.js +++ b/js/misc/extensionUtils.js @@ -235,7 +235,7 @@ var ExtensionFinder = class { : ExtensionType.SYSTEM; try { extension = createExtensionObject(uuid, extensionDir, type); - } catch(e) { + } catch (e) { logError(e, 'Could not load extension %s'.format(uuid)); return; } diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js index d20ad2f32..a01d31254 100644 --- a/js/misc/ibusManager.js +++ b/js/misc/ibusManager.js @@ -62,7 +62,7 @@ var IBusManager = class { try { Gio.Subprocess.new(['ibus-daemon', '--xim', '--panel', 'disable'], Gio.SubprocessFlags.NONE); - } catch(e) { + } catch (e) { log('Failed to launch ibus-daemon: ' + e.message); } } @@ -138,7 +138,7 @@ var IBusManager = class { engine = this._ibus.get_global_engine_async_finish(result); if (!engine) return; - } catch(e) { + } catch (e) { return; } this._engineChanged(this._ibus, engine.get_name()); diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js index 4f4cc836f..1d2c35cf2 100644 --- a/js/misc/loginManager.js +++ b/js/misc/loginManager.js @@ -43,7 +43,7 @@ function canLock() { let version = result.deep_unpack()[0].deep_unpack(); return haveSystemd() && versionCompare('3.5.91', version); - } catch(e) { + } catch (e) { return false; } } @@ -185,7 +185,7 @@ var LoginManagerSystemd = class { let [outVariant, fdList] = proxy.call_with_unix_fd_list_finish(result); fd = fdList.steal_fds()[0]; callback(new Gio.UnixInputStream({ fd: fd })); - } catch(e) { + } catch (e) { logError(e, "Error getting systemd inhibitor"); callback(null); } diff --git a/js/misc/objectManager.js b/js/misc/objectManager.js index cd531d390..c57718df7 100644 --- a/js/misc/objectManager.js +++ b/js/misc/objectManager.js @@ -94,7 +94,7 @@ var ObjectManager = class { (initable, result) => { try { initable.init_finish(result); - } catch(e) { + } catch (e) { logError(e, 'could not initialize proxy for interface ' + interfaceName); if (onFinished) @@ -156,7 +156,7 @@ var ObjectManager = class { _onManagerProxyLoaded(initable, result) { try { initable.init_finish(result); - } catch(e) { + } catch (e) { logError(e, 'could not initialize object manager for object ' + this._serviceName); this._tryToCompleteLoad(); diff --git a/js/misc/util.js b/js/misc/util.js index d944367ce..9362f32ea 100644 --- a/js/misc/util.js +++ b/js/misc/util.js @@ -93,7 +93,7 @@ function spawnApp(argv) { let context = global.create_app_launch_context(0, -1); app.launch([], context); - } catch(err) { + } catch (err) { _handleSpawnError(argv[0], err); } } diff --git a/js/misc/weather.js b/js/misc/weather.js index e804bdee9..66d89fe94 100644 --- a/js/misc/weather.js +++ b/js/misc/weather.js @@ -178,7 +178,7 @@ var WeatherClient = class { (o, res) => { try { this._gclueService = Geoclue.Simple.new_finish(res); - } catch(e) { + } catch (e) { log('Failed to connect to Geoclue2 service: ' + e.message); this._setLocation(this._mostRecentLocation); return; diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index a06079619..b2226d3e3 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -69,7 +69,7 @@ function _getFolderName(folder) { try { keyfile.load_from_data_dirs(path, GLib.KeyFileFlags.NONE); name = keyfile.get_locale_string('Desktop Entry', 'Name', null); - } catch(e) { + } catch (e) { return name; } } @@ -359,7 +359,7 @@ var AllView = class AllView extends BaseAppView { this._appInfoList = Shell.AppSystem.get_default().get_installed().filter(appInfo => { try { (appInfo.get_id()); // catch invalid file encodings - } catch(e) { + } catch (e) { return false; } return appInfo.should_show(); diff --git a/js/ui/audioDeviceSelection.js b/js/ui/audioDeviceSelection.js index 2a83b7fdb..ef7930388 100644 --- a/js/ui/audioDeviceSelection.js +++ b/js/ui/audioDeviceSelection.js @@ -164,7 +164,7 @@ var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus { let dialog; try { dialog = new AudioDeviceSelectionDialog(devices); - } catch(e) { + } catch (e) { invocation.return_value(null); return; } diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 4996cfc30..c121e6bb6 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -168,7 +168,7 @@ var DBusEventSource = class DBusEventSource { try { this._dbusProxy.init_finish(result); loaded = true; - } catch(e) { + } catch (e) { if (e.matches(Gio.DBusError, Gio.DBusError.TIMED_OUT)) { // Ignore timeouts and install signals as normal, because with high // probability the service will appear later on, and we will get a diff --git a/js/ui/components/networkAgent.js b/js/ui/components/networkAgent.js index bc653bc60..03dc0f229 100644 --- a/js/ui/components/networkAgent.js +++ b/js/ui/components/networkAgent.js @@ -406,7 +406,7 @@ var VPNRequestHandler = class { this._vpnChildFinished.bind(this)); this._writeConnection(); - } catch(e) { + } catch (e) { logError(e, 'error while spawning VPN auth helper'); this._agent.respond(requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR); @@ -423,7 +423,7 @@ var VPNRequestHandler = class { } else { try { this._stdin.write('QUIT\n\n', null); - } catch(e) { /* ignore broken pipe errors */ } + } catch (e) { /* ignore broken pipe errors */ } } this.destroy(); @@ -472,7 +472,7 @@ var VPNRequestHandler = class { if (line == '' && this._previousLine == '') { try { this._stdin.write('QUIT\n\n', null); - } catch(e) { /* ignore broken pipe errors */ } + } catch (e) { /* ignore broken pipe errors */ } } else { this._agent.set_password(this._requestId, this._previousLine, line); this._previousLine = undefined; @@ -560,7 +560,7 @@ var VPNRequestHandler = class { this._agent.set_password(this._requestId, groups[i], value); } } - } catch(e) { + } catch (e) { // No output is a valid case it means "both secrets are stored" if (data.length > 0) { logError(e, 'error while reading VPN plugin output keyfile'); @@ -594,7 +594,7 @@ var VPNRequestHandler = class { this._stdin.write('SECRET_VAL=' + (value || '') + '\n\n', null); }); this._stdin.write('DONE\n\n', null); - } catch(e) { + } catch (e) { logError(e, 'internal error while writing connection to helper'); this._agent.respond(this._requestId, Shell.NetworkAgentResponse.INTERNAL_ERROR); @@ -619,7 +619,7 @@ var NetworkAgent = class { try { let monitor = this._pluginDir.monitor(Gio.FileMonitorFlags.NONE, null); monitor.connect('changed', () => { this._vpnCacheBuilt = false; }); - } catch(e) { + } catch (e) { log('Failed to create monitor for VPN plugin dir: ' + e.message); } @@ -631,7 +631,7 @@ var NetworkAgent = class { try { this._native.init_finish(res); this._initialized = true; - } catch(e) { + } catch (e) { this._native = null; logError(e, 'error initializing the NetworkManager Agent'); } diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js index 8ce266701..c32d52b0f 100644 --- a/js/ui/components/polkitAgent.js +++ b/js/ui/components/polkitAgent.js @@ -342,7 +342,7 @@ var AuthenticationAgent = class { enable() { try { this._native.register(); - } catch(e) { + } catch (e) { log('Failed to register AuthenticationAgent'); } } @@ -350,7 +350,7 @@ var AuthenticationAgent = class { disable() { try { this._native.unregister(); - } catch(e) { + } catch (e) { log('Failed to unregister AuthenticationAgent'); } } diff --git a/js/ui/components/telepathyClient.js b/js/ui/components/telepathyClient.js index 1292d9a00..6e81bab59 100644 --- a/js/ui/components/telepathyClient.js +++ b/js/ui/components/telepathyClient.js @@ -8,7 +8,7 @@ var Tpl = null; var Tp = null; try { ({ TelepathyGLib: Tp, TelepathyLogger: Tpl } = imports.gi); -} catch(e) { +} catch (e) { log('Telepathy is not available, chat integration will be disabled.'); } diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js index cdba84c03..63e824578 100644 --- a/js/ui/endSessionDialog.js +++ b/js/ui/endSessionDialog.js @@ -155,7 +155,7 @@ function findAppFromInhibitor(inhibitor) { let desktopFile; try { [desktopFile] = inhibitor.GetAppIdSync(); - } catch(e) { + } catch (e) { // XXX -- sometimes JIT inhibitors generated by gnome-session // get removed too soon. Don't fail in this case. log('gnome-session gave us a dead inhibitor: %s'.format(inhibitor.get_object_path())); @@ -335,7 +335,7 @@ class EndSessionDialog extends ModalDialog.ModalDialog { try { this._updatesPermission = Polkit.Permission.new_sync("org.freedesktop.packagekit.trigger-offline-update", null, null); - } catch(e) { + } catch (e) { log('No permission to trigger offline updates: %s'.format(e.toString())); } diff --git a/js/ui/environment.js b/js/ui/environment.js index 573857126..c936c5b42 100644 --- a/js/ui/environment.js +++ b/js/ui/environment.js @@ -114,7 +114,7 @@ function init() { return base.replace(/\]$/, ' delegate for ' + this.actor.toString().substring(1)); else return base; - } catch(e) { + } catch (e) { return base; } }; diff --git a/js/ui/extensionDownloader.js b/js/ui/extensionDownloader.js index d86ae92af..4d414697a 100644 --- a/js/ui/extensionDownloader.js +++ b/js/ui/extensionDownloader.js @@ -127,7 +127,7 @@ function updateExtension(uuid) { try { extension = ExtensionUtils.createExtensionObject(uuid, extensionDir, ExtensionUtils.ExtensionType.PER_USER); ExtensionSystem.loadExtension(extension); - } catch(e) { + } catch (e) { if (extension) ExtensionSystem.unloadExtension(extension); @@ -234,7 +234,7 @@ class InstallExtensionDialog extends ModalDialog.ModalDialog { try { let extension = ExtensionUtils.createExtensionObject(uuid, dir, ExtensionUtils.ExtensionType.PER_USER); ExtensionSystem.loadExtension(extension); - } catch(e) { + } catch (e) { uninstallExtension(uuid); errback('LoadExtensionError', e); return; diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index a53838d58..983d7129e 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -64,7 +64,7 @@ function disableExtension(uuid) { let uuid = orderReversed[i]; try { ExtensionUtils.extensions[uuid].stateObj.disable(); - } catch(e) { + } catch (e) { logExtensionError(uuid, e); } } @@ -77,7 +77,7 @@ function disableExtension(uuid) { try { extension.stateObj.disable(); - } catch(e) { + } catch (e) { logExtensionError(uuid, e); } @@ -85,7 +85,7 @@ function disableExtension(uuid) { let uuid = order[i]; try { ExtensionUtils.extensions[uuid].stateObj.enable(); - } catch(e) { + } catch (e) { logExtensionError(uuid, e); } } @@ -132,7 +132,7 @@ function enableExtension(uuid) { extension.state = ExtensionState.ENABLED; _signals.emit('extension-state-changed', extension); return; - } catch(e) { + } catch (e) { if (extension.stylesheet) { theme.unload_stylesheet(extension.stylesheet); delete extension.stylesheet; @@ -208,7 +208,7 @@ function reloadExtension(oldExtension) { let newExtension; try { newExtension = ExtensionUtils.createExtensionObject(uuid, dir, type); - } catch(e) { + } catch (e) { logExtensionError(uuid, e); return; } @@ -235,7 +235,7 @@ function initExtension(uuid) { ExtensionUtils.installImporter(extension); try { extensionModule = extension.imports.extension; - } catch(e) { + } catch (e) { logExtensionError(uuid, e); return false; } @@ -243,7 +243,7 @@ function initExtension(uuid) { if (extensionModule.init) { try { extensionState = extensionModule.init(extension); - } catch(e) { + } catch (e) { logExtensionError(uuid, e); return false; } diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js index fe421c557..f51b78971 100644 --- a/js/ui/ibusCandidatePopup.js +++ b/js/ui/ibusCandidatePopup.js @@ -181,7 +181,7 @@ var CandidatePopup = class CandidatePopup { let window = global.display.focus_window.get_compositor_private(); this._setDummyCursorGeometry(window.x + x, window.y + y, w, h); }); - } catch(e) { + } catch (e) { // Only recent IBus versions have support for this signal // which is used for wayland clients. In order to work // with older IBus versions we can silently ignore the diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index fca06e206..0128d68d5 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -798,7 +798,7 @@ var ZoomRegion = class ZoomRegion { let extents; try { extents = component.get_extents(Atspi.CoordType.SCREEN); - } catch(e) { + } catch (e) { log('Failed to read extents of focused component: ' + e.message); return; } @@ -815,7 +815,7 @@ var ZoomRegion = class ZoomRegion { let extents; try { extents = text.get_character_extents(text.get_caret_offset(), 0); - } catch(e) { + } catch (e) { log('Failed to read extents of text caret: ' + e.message); return; } diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js index 4bdede841..84147d41a 100644 --- a/js/ui/notificationDaemon.js +++ b/js/ui/notificationDaemon.js @@ -759,7 +759,7 @@ var GtkNotificationDaemon = class GtkNotificationDaemon { let source; try { source = this._ensureAppSource(appId); - } catch(e) { + } catch (e) { if (e instanceof InvalidAppError) return; throw e; @@ -793,7 +793,7 @@ var GtkNotificationDaemon = class GtkNotificationDaemon { let source; try { source = this._ensureAppSource(appId); - } catch(e) { + } catch (e) { if (e instanceof InvalidAppError) { invocation.return_dbus_error('org.gtk.Notifications.InvalidApp', 'The app by ID "%s" could not be found'.format(appId)); return; diff --git a/js/ui/remoteSearch.js b/js/ui/remoteSearch.js index ae6c6dab7..d17dad269 100644 --- a/js/ui/remoteSearch.js +++ b/js/ui/remoteSearch.js @@ -69,7 +69,7 @@ function loadRemoteSearchProviders(searchSettings, callback) { try { keyfile.load_from_file(path, 0); - } catch(e) { + } catch (e) { return; } @@ -99,7 +99,7 @@ function loadRemoteSearchProviders(searchSettings, callback) { let autoStart = true; try { autoStart = keyfile.get_boolean(group, 'AutoStart'); - } catch(e) { + } catch (e) { // ignore error } @@ -118,13 +118,13 @@ function loadRemoteSearchProviders(searchSettings, callback) { remoteProvider.defaultEnabled = true; try { remoteProvider.defaultEnabled = !keyfile.get_boolean(group, 'DefaultDisabled'); - } catch(e) { + } catch (e) { // ignore error } objectPaths[objectPath] = remoteProvider; loadedProviders.push(remoteProvider); - } catch(e) { + } catch (e) { log('Failed to add search provider %s: %s'.format(path, e.toString())); } } diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js index 70a6e8a15..2a75e9cb7 100644 --- a/js/ui/sessionMode.js +++ b/js/ui/sessionMode.js @@ -120,7 +120,7 @@ function _loadMode(file, info) { if (fileContent instanceof Uint8Array) fileContent = imports.byteArray.toString(fileContent); newMode = JSON.parse(fileContent); - } catch(e) { + } catch (e) { return; } diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index 17abe8a92..8215a5549 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -199,7 +199,7 @@ var InputSourceSystemSettings = class extends InputSourceSettings { let props; try { props = conn.call_finish(result).deep_unpack()[0]; - } catch(e) { + } catch (e) { log('Could not get properties from ' + this._BUS_NAME); return; } diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 8ad451347..b47b27dc0 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -1981,7 +1981,7 @@ var NMApplet = class extends PanelMenu.SystemIndicator { let state = client.check_connectivity_finish(result); if (state >= NM.ConnectivityState.FULL) this._closeConnectivityCheck(path); - } catch(e) { } + } catch (e) { } }); } else { log('Invalid result from portal helper: ' + result); diff --git a/js/ui/status/thunderbolt.js b/js/ui/status/thunderbolt.js index b36819a53..728729812 100644 --- a/js/ui/status/thunderbolt.js +++ b/js/ui/status/thunderbolt.js @@ -67,7 +67,7 @@ var Client = class { _onProxyReady(o, res) { try { this._proxy = Gio.DBusProxy.new_finish(res); - } catch(e) { + } catch (e) { log('error creating bolt proxy: %s'.format(e.message)); return; }