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 Me = extensionUtils.getCurrentExtension();
|
||||||
const config = Me.imports.config;
|
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 { Themer } = Me.imports.modules.Themer;
|
||||||
const { Timer } = Me.imports.modules.Timer;
|
const { Timer } = Me.imports.modules.Timer;
|
||||||
@@ -65,9 +65,7 @@ var Switcher = class {
|
|||||||
log_debug('Extension enabled.');
|
log_debug('Extension enabled.');
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
if ( e.message ) {
|
log_error(e);
|
||||||
main.notifyError(Me.metadata.name, e.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,9 +89,7 @@ var Switcher = class {
|
|||||||
this.theme.set_variant(this.time.current);
|
this.theme.set_variant(this.time.current);
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
if ( e.message ) {
|
log_error(e);
|
||||||
main.notifyError(Me.metadata.name, e.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,9 +98,7 @@ var Switcher = class {
|
|||||||
this.theme.set_variant(this.time.current);
|
this.theme.set_variant(this.time.current);
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
if ( e.message ) {
|
log_error(e);
|
||||||
main.notifyError(Me.metadata.name, e.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const Me = extensionUtils.getCurrentExtension();
|
|||||||
const config = Me.imports.config;
|
const config = Me.imports.config;
|
||||||
const utils = Me.imports.utils;
|
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;
|
const { Variants } = Me.imports.modules.Variants;
|
||||||
|
|
||||||
@@ -66,9 +66,7 @@ var Themer = class {
|
|||||||
log_debug('Themer enabled.');
|
log_debug('Themer enabled.');
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
if ( e.message ) {
|
log_error(e);
|
||||||
main.notifyError(Me.metadata.name, e.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,11 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
|||||||
const MainLoop = imports.mainloop;
|
const MainLoop = imports.mainloop;
|
||||||
const { Gio, GLib } = imports.gi;
|
const { Gio, GLib } = imports.gi;
|
||||||
const { extensionUtils, fileUtils } = imports.misc;
|
const { extensionUtils, fileUtils } = imports.misc;
|
||||||
const { main } = imports.ui;
|
|
||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
const config = Me.imports.config;
|
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 = imports.gettext.domain(Me.metadata.uuid);
|
||||||
const _ = Gettext.gettext;
|
const _ = Gettext.gettext;
|
||||||
@@ -85,9 +84,7 @@ var Timer = class {
|
|||||||
log_debug('Timer enabled.');
|
log_debug('Timer enabled.');
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
if ( e.message ) {
|
log_error(e);
|
||||||
main.notifyError(Me.metadata.name, e.message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ this program. If not, see <http s ://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
const { Gio, GLib, Gtk } = imports.gi;
|
const { Gio, GLib, Gtk } = imports.gi;
|
||||||
const { extensionUtils } = imports.misc;
|
const { extensionUtils } = imports.misc;
|
||||||
|
const { main } = imports.ui;
|
||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
const config = Me.imports.config;
|
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() {
|
var get_installed_themes = function() {
|
||||||
const themes = new Set(['Adwaita', 'HighContrast', 'HighContrastInverse']);
|
const themes = new Set(['Adwaita', 'HighContrast', 'HighContrastInverse']);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user