File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -192,8 +192,12 @@ export class BIDSContext implements Context {
192192 }
193193 for ( const file of sidecars ) {
194194 const json = await loadJSON ( file ) . catch ( ( error ) => {
195- this . dataset . issues . add ( { code : error . key , location : file . path } )
196- return { }
195+ if ( error . key ) {
196+ this . dataset . issues . add ( { code : error . key , location : file . path } )
197+ return { }
198+ } else {
199+ throw error
200+ }
197201 } )
198202 this . sidecar = { ...json , ...this . sidecar }
199203 Object . keys ( json ) . map ( ( x ) => this . sidecarKeyOrigin [ x ] ??= file . path )
@@ -210,8 +214,12 @@ export class BIDSContext implements Context {
210214 ) return
211215
212216 this . nifti_header = await loadHeader ( this . file ) . catch ( ( error ) => {
213- this . dataset . issues . add ( { code : error . key , location : this . file . path } )
214- return undefined
217+ if ( error . key ) {
218+ this . dataset . issues . add ( { code : error . key , location : this . file . path } )
219+ return undefined
220+ } else {
221+ throw error
222+ }
215223 } )
216224 }
217225
@@ -244,8 +252,12 @@ export class BIDSContext implements Context {
244252 return
245253 }
246254 this . json = await loadJSON ( this . file ) . catch ( ( error ) => {
247- this . dataset . issues . add ( { code : error . key , location : this . file . path } )
248- return { }
255+ if ( error . key ) {
256+ this . dataset . issues . add ( { code : error . key , location : this . file . path } )
257+ return { }
258+ } else {
259+ throw error
260+ }
249261 } )
250262 }
251263
Original file line number Diff line number Diff line change @@ -56,8 +56,12 @@ export async function validate(
5656 const dsContext = new BIDSContextDataset ( { options, schema, tree : fileTree } )
5757 if ( ddFile ) {
5858 dsContext . dataset_description = await loadJSON ( ddFile ) . catch ( ( error ) => {
59- dsContext . issues . add ( { code : error . key , location : ddFile . path } )
60- return { } as Record < string , unknown >
59+ if ( error . key ) {
60+ dsContext . issues . add ( { code : error . key , location : ddFile . path } )
61+ return { } as Record < string , unknown >
62+ } else {
63+ throw error
64+ }
6165 } )
6266 summary . dataProcessed = dsContext . dataset_description . DatasetType === 'derivative'
6367 } else {
You can’t perform that action at this time.
0 commit comments