From f3144d472a944487f1f9fcc8dd0e44250d786f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 30 Nov 2024 14:43:14 +0100 Subject: [PATCH] places-menu: Catch errors during async operation Uncaught errors in async functions don't provide a good stack, because the unhandled promise rejection masks the error that triggered it. While we already handle *expected* errors inside the function, make sure we catch all errors to get useful stack information for unexpected errors as well. Part-of: (cherry picked from commit e0b68a319e3ec5d47b42ba720211c8d6139fdf82) --- extensions/places-menu/placeDisplay.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/places-menu/placeDisplay.js b/extensions/places-menu/placeDisplay.js index d0caa8a9..8a8083d3 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -68,7 +68,7 @@ class PlaceInfo extends EventEmitter { await this.file.mount_enclosing_volume(0, op.mountOp, null); if (tryMount) - this._ensureMountAndLaunch(context, false); + this._ensureMountAndLaunch(context, false).catch(logError); } catch (e) { if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED)) Main.notifyError(_('Failed to mount volume for ā€œ%sā€').format(this.name), e.message); @@ -80,7 +80,7 @@ class PlaceInfo extends EventEmitter { launch(timestamp) { let launchContext = global.create_app_launch_context(timestamp, -1); - this._ensureMountAndLaunch(launchContext, true); + this._ensureMountAndLaunch(launchContext, true).catch(logError); } getIcon() {