File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,9 @@ const importSingleFile: ImportHandler = async (dataSource) => {
4343 return asLoadableResult ( dataID , dataSource , 'model' ) ;
4444 }
4545
46- throw new Error ( 'Data reader did not produce a valid dataset' ) ;
46+ throw new Error (
47+ `Failed to import "${ dataSource . file . name } ". The file may be corrupted or in an unsupported format variant.`
48+ ) ;
4749} ;
4850
4951export default importSingleFile ;
Original file line number Diff line number Diff line change 11import { Skip } from '@/src/utils/evaluateChain' ;
22import { getFileMimeType } from '@/src/io' ;
33import { ImportHandler , asIntermediateResult } from '@/src/io/import/common' ;
4+ import { MIME_TYPES } from '@/src/io/mimeTypes' ;
45
56/**
67 * Transforms a file data source to have a mime type
78 * @param dataSource
89 */
910const updateFileMimeType : ImportHandler = async ( dataSource ) => {
10- if ( dataSource . type !== 'file' || dataSource . fileType !== '' ) return Skip ;
11+ if ( dataSource . type !== 'file' ) return Skip ;
12+
13+ const knownType =
14+ dataSource . fileType !== '' && MIME_TYPES . has ( dataSource . fileType ) ;
15+ if ( knownType ) {
16+ return Skip ;
17+ }
1118
1219 const mime = await getFileMimeType ( dataSource . file ) ;
20+
1321 if ( ! mime ) {
14- throw new Error ( 'File is unsupported' ) ;
22+ throw new Error (
23+ `Unrecognized file type for "${ dataSource . file . name } ". This file format is not supported.`
24+ ) ;
1525 }
1626
1727 return asIntermediateResult ( [
You can’t perform that action at this time.
0 commit comments