Stop using conditional catch statements
It is a mozilla extension that is going away in SpiderMonkey 60. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/151
This commit is contained in:
parent
22392d1328
commit
e36ba874a8
@ -350,16 +350,19 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
try {
|
try {
|
||||||
this._clearUserVerifier();
|
this._clearUserVerifier();
|
||||||
this._userVerifier = client.open_reauthentication_channel_finish(result);
|
this._userVerifier = client.open_reauthentication_channel_finish(result);
|
||||||
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
|
||||||
return;
|
|
||||||
} catch(e if e.matches(Gio.DBusError, Gio.DBusError.ACCESS_DENIED) &&
|
|
||||||
!this._reauthOnly) {
|
|
||||||
// Gdm emits org.freedesktop.DBus.Error.AccessDenied when there is
|
|
||||||
// no session to reauthenticate. Fall back to performing verification
|
|
||||||
// from this login session
|
|
||||||
client.get_user_verifier(this._cancellable, this._userVerifierGot.bind(this));
|
|
||||||
return;
|
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||||
|
return;
|
||||||
|
if (e.matches(Gio.DBusError, Gio.DBusError.ACCESS_DENIED) &&
|
||||||
|
!this._reauthOnly) {
|
||||||
|
// Gdm emits org.freedesktop.DBus.Error.AccessDenied when there
|
||||||
|
// is no session to reauthenticate. Fall back to performing
|
||||||
|
// verification from this login session
|
||||||
|
client.get_user_verifier(this._cancellable,
|
||||||
|
this._userVerifierGot.bind(this));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._reportInitError('Failed to open reauthentication channel', e);
|
this._reportInitError('Failed to open reauthentication channel', e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -374,9 +377,9 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
try {
|
try {
|
||||||
this._clearUserVerifier();
|
this._clearUserVerifier();
|
||||||
this._userVerifier = client.get_user_verifier_finish(result);
|
this._userVerifier = client.get_user_verifier_finish(result);
|
||||||
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
|
||||||
return;
|
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||||
|
return;
|
||||||
this._reportInitError('Failed to obtain user verifier', e);
|
this._reportInitError('Failed to obtain user verifier', e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -434,9 +437,9 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
(obj, result) => {
|
(obj, result) => {
|
||||||
try {
|
try {
|
||||||
obj.call_begin_verification_for_user_finish(result);
|
obj.call_begin_verification_for_user_finish(result);
|
||||||
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
|
||||||
return;
|
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||||
|
return;
|
||||||
this._reportInitError('Failed to start verification for user', e);
|
this._reportInitError('Failed to start verification for user', e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -449,9 +452,9 @@ var ShellUserVerifier = new Lang.Class({
|
|||||||
(obj, result) => {
|
(obj, result) => {
|
||||||
try {
|
try {
|
||||||
obj.call_begin_verification_finish(result);
|
obj.call_begin_verification_finish(result);
|
||||||
} catch(e if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) {
|
|
||||||
return;
|
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
if (e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
|
||||||
|
return;
|
||||||
this._reportInitError('Failed to start verification', e);
|
this._reportInitError('Failed to start verification', e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -831,8 +831,10 @@ var GtkNotificationDaemon = new Lang.Class({
|
|||||||
let source;
|
let source;
|
||||||
try {
|
try {
|
||||||
source = this._ensureAppSource(appId);
|
source = this._ensureAppSource(appId);
|
||||||
} catch(e if e instanceof InvalidAppError) {
|
} catch(e) {
|
||||||
return;
|
if (e instanceof InvalidAppError)
|
||||||
|
return;
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
notifications.forEach(([notificationId, notification]) => {
|
notifications.forEach(([notificationId, notification]) => {
|
||||||
@ -863,9 +865,12 @@ var GtkNotificationDaemon = new Lang.Class({
|
|||||||
let source;
|
let source;
|
||||||
try {
|
try {
|
||||||
source = this._ensureAppSource(appId);
|
source = this._ensureAppSource(appId);
|
||||||
} catch(e if e instanceof InvalidAppError) {
|
} catch(e) {
|
||||||
invocation.return_dbus_error('org.gtk.Notifications.InvalidApp', 'The app by ID "%s" could not be found'.format(appId));
|
if (e instanceof InvalidAppError) {
|
||||||
return;
|
invocation.return_dbus_error('org.gtk.Notifications.InvalidApp', 'The app by ID "%s" could not be found'.format(appId));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
let timestamp = GLib.DateTime.new_now_local().to_unix();
|
let timestamp = GLib.DateTime.new_now_local().to_unix();
|
||||||
|
@ -172,9 +172,10 @@ var RunDialog = new Lang.Class({
|
|||||||
if (name.slice(0, text.length) == text)
|
if (name.slice(0, text.length) == text)
|
||||||
results.push(name);
|
results.push(name);
|
||||||
}
|
}
|
||||||
} catch (e if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND) &&
|
} catch (e) {
|
||||||
!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_DIRECTORY))) {
|
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND) &&
|
||||||
log(e);
|
!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_DIRECTORY))
|
||||||
|
log(e);
|
||||||
} finally {
|
} finally {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
@ -216,12 +216,14 @@ function _step(g, finish, onError) {
|
|||||||
if (onError)
|
if (onError)
|
||||||
onError(err);
|
onError(err);
|
||||||
});
|
});
|
||||||
} catch (err if err instanceof StopIteration) {
|
|
||||||
if (finish)
|
|
||||||
finish();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (onError)
|
if (err instanceof StopIteration) {
|
||||||
onError(err);
|
if (finish)
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
if (onError)
|
||||||
|
onError(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user