Skip to content

Commit 1201332

Browse files
committed
notificationDaemon.js: Improve notification error handling.
Followup to 361526c.
1 parent 361526c commit 1201332

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

js/ui/notificationDaemon.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,17 @@ NotificationDaemon.prototype = {
372372
this._notifyForSource(source, ndata);
373373
return invocation.return_value(GLib.Variant.new('(u)', [id]));
374374
} catch (e) {
375-
return invocation.return_gerror(e);
375+
global.logError(e);
376+
if (e instanceof GLib.Error) {
377+
return invocation.return_gerror(e);
378+
} else {
379+
let name = e.name;
380+
if (!name.includes('.')) {
381+
name = `org.gnome.gjs.JSError.${name}`;
382+
}
383+
384+
return invocation.return_dbus_error(name, e.message);
385+
}
376386
}
377387
}
378388

@@ -411,7 +421,12 @@ NotificationDaemon.prototype = {
411421
delete this._senderToPid[sender];
412422
}));
413423
}
414-
this._notifyForSource(source, ndata);
424+
425+
try {
426+
this._notifyForSource(source, ndata);
427+
} catch (e) {
428+
global.logError(e);
429+
}
415430
}));
416431

417432
return invocation.return_value(GLib.Variant.new('(u)', [id]));

0 commit comments

Comments
 (0)