File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -21,10 +21,15 @@ export const FullscreenDropzone = () => {
21
21
] }
22
22
onReject = { files => toast . error ( `Unable to load file ${ files [ 0 ] . file . name } ` ) }
23
23
onDrop = { async e => {
24
- const fileContent = await e [ 0 ] . text ( ) ;
25
- let fileExtension = e [ 0 ] . name . split ( "." ) . pop ( ) as FileFormat | undefined ;
26
- if ( ! fileExtension ) fileExtension = FileFormat . JSON ;
27
- setContents ( { contents : fileContent , format : fileExtension , hasChanges : false } ) ;
24
+ try {
25
+ const fileContent = await e [ 0 ] . text ( ) ;
26
+ let fileExtension = e [ 0 ] . name . split ( "." ) . pop ( ) as FileFormat | undefined ;
27
+ if ( ! fileExtension ) fileExtension = FileFormat . JSON ;
28
+ setContents ( { contents : fileContent , format : fileExtension , hasChanges : false } ) ;
29
+ } catch ( err ) {
30
+ toast . error ( "An error occurred while reading the file." ) ;
31
+ console . error ( err ) ;
32
+ }
28
33
} }
29
34
>
30
35
< Group
You can’t perform that action at this time.
0 commit comments