Merge branch 'refactor/error' into 'master'
Improve error handling See merge request rmnvgr/nightthemeswitcher-gnome-shell-extension!24
This commit is contained in:
+4
-10
@@ -22,7 +22,7 @@ const { main } = imports.ui;
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
const config = Me.imports.config;
|
||||
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { log_debug, log_error } = Me.imports.utils;
|
||||
|
||||
const { Themer } = Me.imports.modules.Themer;
|
||||
const { Timer } = Me.imports.modules.Timer;
|
||||
@@ -65,9 +65,7 @@ var Switcher = class {
|
||||
log_debug('Extension enabled.');
|
||||
}
|
||||
catch(e) {
|
||||
if ( e.message ) {
|
||||
main.notifyError(Me.metadata.name, e.message);
|
||||
}
|
||||
log_error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,9 +89,7 @@ var Switcher = class {
|
||||
this.theme.set_variant(this.time.current);
|
||||
}
|
||||
catch(e) {
|
||||
if ( e.message ) {
|
||||
main.notifyError(Me.metadata.name, e.message);
|
||||
}
|
||||
log_error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,9 +98,7 @@ var Switcher = class {
|
||||
this.theme.set_variant(this.time.current);
|
||||
}
|
||||
catch(e) {
|
||||
if ( e.message ) {
|
||||
main.notifyError(Me.metadata.name, e.message);
|
||||
}
|
||||
log_error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ const Me = extensionUtils.getCurrentExtension();
|
||||
const config = Me.imports.config;
|
||||
const utils = Me.imports.utils;
|
||||
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { log_debug, log_error } = Me.imports.utils;
|
||||
|
||||
const { Variants } = Me.imports.modules.Variants;
|
||||
|
||||
@@ -66,9 +66,7 @@ var Themer = class {
|
||||
log_debug('Themer enabled.');
|
||||
}
|
||||
catch(e) {
|
||||
if ( e.message ) {
|
||||
main.notifyError(Me.metadata.name, e.message);
|
||||
}
|
||||
log_error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,11 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
const MainLoop = imports.mainloop;
|
||||
const { Gio, GLib } = imports.gi;
|
||||
const { extensionUtils, fileUtils } = imports.misc;
|
||||
const { main } = imports.ui;
|
||||
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
const config = Me.imports.config;
|
||||
|
||||
const { log_debug } = Me.imports.utils;
|
||||
const { log_debug, log_error } = Me.imports.utils;
|
||||
|
||||
const Gettext = imports.gettext.domain(Me.metadata.uuid);
|
||||
const _ = Gettext.gettext;
|
||||
@@ -85,9 +84,7 @@ var Timer = class {
|
||||
log_debug('Timer enabled.');
|
||||
}
|
||||
catch(e) {
|
||||
if ( e.message ) {
|
||||
main.notifyError(Me.metadata.name, e.message);
|
||||
}
|
||||
log_error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
||||
|
||||
const { Gio, GLib, Gtk } = imports.gi;
|
||||
const { extensionUtils } = imports.misc;
|
||||
const { main } = imports.ui;
|
||||
|
||||
const Me = extensionUtils.getCurrentExtension();
|
||||
const config = Me.imports.config;
|
||||
@@ -29,6 +30,13 @@ var log_debug = function(message) {
|
||||
}
|
||||
}
|
||||
|
||||
var log_error = function(error) {
|
||||
logError(error, Me.metadata.name);
|
||||
if ( error.message ) {
|
||||
main.notifyError(Me.metadata.name, error.message);
|
||||
}
|
||||
}
|
||||
|
||||
var get_installed_themes = function() {
|
||||
const themes = new Set(['Adwaita', 'HighContrast', 'HighContrastInverse']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user