Improve error handling
This commit is contained in:
+7
-5
@@ -41,6 +41,7 @@ class Switcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enable() {
|
enable() {
|
||||||
|
try {
|
||||||
this.theme = new Themer();
|
this.theme = new Themer();
|
||||||
this.variants = Variants.guess_from(this.theme.current);
|
this.variants = Variants.guess_from(this.theme.current);
|
||||||
this.theme.listen(this._on_theme_change.bind(this));
|
this.theme.listen(this._on_theme_change.bind(this));
|
||||||
@@ -50,6 +51,10 @@ class Switcher {
|
|||||||
|
|
||||||
this._apply_theme_variant();
|
this._apply_theme_variant();
|
||||||
}
|
}
|
||||||
|
catch(e) {
|
||||||
|
main.notifyError(EXT_NAME, e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
disable() {
|
disable() {
|
||||||
try {
|
try {
|
||||||
@@ -57,10 +62,7 @@ class Switcher {
|
|||||||
this.theme.stop_listening();
|
this.theme.stop_listening();
|
||||||
this.nightlight.stop_listening();
|
this.nightlight.stop_listening();
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {}
|
||||||
const message = _('Errors occured while disabling the extension, try removing it.');
|
|
||||||
main.notifyError(EXT_NAME, message);
|
|
||||||
}
|
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
this.theme = null;
|
this.theme = null;
|
||||||
@@ -119,7 +121,7 @@ class Nightlighter {
|
|||||||
this._connect_to_dbus();
|
this._connect_to_dbus();
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
main.notifyError(EXT_NAME, e);
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user