From e0b68a319e3ec5d47b42ba720211c8d6139fdf82 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: --- 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 faf1d3ac..70165661 100644 --- a/extensions/places-menu/placeDisplay.js +++ b/extensions/places-menu/placeDisplay.js @@ -62,7 +62,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); @@ -74,7 +74,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() {