extensionSystem: Don't log error name

logExtensionError() currently saves the error message by calling
toString() on the passed error. That's convenient as it allows to
pass a string instead of a "proper" error, but the result isn't
great for the common Error case: Its toString() method prefixes
the message with the error name, which usually is just "Error:".

The plain message is more suitable for displaying it to users,
so use that for Error objects.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2337
This commit is contained in:
Florian Müllner 2020-05-12 01:12:50 +02:00 committed by Florian Müllner
parent d2583aa47b
commit 48e6a58250

View File

@ -260,7 +260,8 @@ var ExtensionManager = class {
if (!extension)
return;
let message = error.toString();
const message = error instanceof Error
? error.message : error.toString();
extension.error = message;
extension.state = ExtensionState.ERROR;