From f0374cf9d9dfb533d16adc29389359834f16f082 Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Wed, 27 Feb 2019 16:06:59 +0100 Subject: [PATCH] Fix error message not showing when an unsupported image is selected Changelog-entry: Fix error message not showing when an unsupported image is selected Change-type: patch --- .../pages/main/controllers/image-selection.js | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/gui/app/pages/main/controllers/image-selection.js b/lib/gui/app/pages/main/controllers/image-selection.js index eeb3f2b7..e7ad1313 100644 --- a/lib/gui/app/pages/main/controllers/image-selection.js +++ b/lib/gui/app/pages/main/controllers/image-selection.js @@ -175,18 +175,17 @@ module.exports = function ( $timeout() }) }) - .catch((error) => { - const imageError = errors.createUserError({ - title: 'Error opening image', - description: messages.error.openImage(path.basename(imagePath), error.message) - }) - osDialog.showError(imageError) - analytics.logException(error) - }) - .then(() => { - return innerSource.close() - .catch(_.noop) - }) + }) + .catch((error) => { + const imageError = errors.createUserError({ + title: 'Error opening image', + description: messages.error.openImage(path.basename(imagePath), error.message) + }) + osDialog.showError(imageError) + analytics.logException(error) + }) + .finally(() => { + return source.close().catch(_.noop) }) }