From f1ddfbfe72f39c0e092e2b745e710c8743c6fdd4 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Tue, 9 Nov 2021 15:02:28 +0100 Subject: [PATCH] try catch on set workspace --- libs/remix-ui/workspace/src/lib/actions/workspace.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index 172d4a0cd4..9e227e3dc3 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -246,11 +246,12 @@ export const uploadFile = async (target, targetFolder: string, cb?: (err: Error, if (checkSpecialChars(file.name)) { return dispatch(displayNotification('File Upload Failed', 'Special characters are not allowed', 'Close', null, async () => {})) } - const success = await workspaceProvider.set(name, event.target.result) - - if (!success) { + try { + await workspaceProvider.set(name, event.target.result) + } catch (error) { return dispatch(displayNotification('File Upload Failed', 'Failed to create file ' + name, 'Close', null, async () => {})) } + const config = plugin.registry.get('config').api const editor = plugin.registry.get('editor').api