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
This commit is contained in:
parent
d008c6c5c5
commit
f250643385
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -164,7 +164,7 @@ var AudioDeviceSelectionDBus = class AudioDeviceSelectionDBus {
|
||||
let dialog;
|
||||
try {
|
||||
dialog = new AudioDeviceSelectionDialog(devices);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
invocation.return_value(null);
|
||||
return;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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');
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
@ -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.');
|
||||
}
|
||||
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user