Improve error handling

This commit is contained in:
Romain Vigier
2020-02-08 23:17:25 +01:00
parent f6ba91e3f1
commit 6316b3b78f
+7 -5
View File
@@ -41,6 +41,7 @@ class Switcher {
}
enable() {
try {
this.theme = new Themer();
this.variants = Variants.guess_from(this.theme.current);
this.theme.listen(this._on_theme_change.bind(this));
@@ -50,6 +51,10 @@ class Switcher {
this._apply_theme_variant();
}
catch(e) {
main.notifyError(EXT_NAME, e.message);
}
}
disable() {
try {
@@ -57,10 +62,7 @@ class Switcher {
this.theme.stop_listening();
this.nightlight.stop_listening();
}
catch(e) {
const message = _('Errors occured while disabling the extension, try removing it.');
main.notifyError(EXT_NAME, message);
}
catch(e) {}
finally
{
this.theme = null;
@@ -119,7 +121,7 @@ class Nightlighter {
this._connect_to_dbus();
}
catch(e) {
main.notifyError(EXT_NAME, e);
throw e;
}
}