try catch on set workspace

pull/1647/head
filip mertens 3 years ago
parent afd31809f1
commit f1ddfbfe72
  1. 7
      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)) { if (checkSpecialChars(file.name)) {
return dispatch(displayNotification('File Upload Failed', 'Special characters are not allowed', 'Close', null, async () => {})) return dispatch(displayNotification('File Upload Failed', 'Special characters are not allowed', 'Close', null, async () => {}))
} }
const success = await workspaceProvider.set(name, event.target.result) try {
await workspaceProvider.set(name, event.target.result)
if (!success) { } catch (error) {
return dispatch(displayNotification('File Upload Failed', 'Failed to create file ' + name, 'Close', null, async () => {})) return dispatch(displayNotification('File Upload Failed', 'Failed to create file ' + name, 'Close', null, async () => {}))
} }
const config = plugin.registry.get('config').api const config = plugin.registry.get('config').api
const editor = plugin.registry.get('editor').api const editor = plugin.registry.get('editor').api

Loading…
Cancel
Save