@@ -210,8 +210,8 @@ export class BIDSContext implements Context {
210210 }
211211 for ( const file of sidecars ) {
212212 const json = await loadJSON ( file ) . catch ( ( error ) => {
213- if ( error . key ) {
214- this . dataset . issues . add ( { code : error . key , location : file . path } )
213+ if ( error . code ) {
214+ this . dataset . issues . add ( { ... error , location : file . path } )
215215 return { }
216216 } else {
217217 throw error
@@ -232,8 +232,8 @@ export class BIDSContext implements Context {
232232 ) return
233233
234234 this . nifti_header = await loadHeader ( this . file ) . catch ( ( error ) => {
235- if ( error . key ) {
236- this . dataset . issues . add ( { code : error . key , location : this . file . path } )
235+ if ( error . code ) {
236+ this . dataset . issues . add ( { ... error , location : this . file . path } )
237237 return undefined
238238 } else {
239239 throw error
@@ -248,8 +248,8 @@ export class BIDSContext implements Context {
248248
249249 this . columns = await loadTSV ( this . file , this . dataset . options ?. maxRows )
250250 . catch ( ( error ) => {
251- if ( error . key ) {
252- this . dataset . issues . add ( { code : error . key , location : this . file . path } )
251+ if ( error . code ) {
252+ this . dataset . issues . add ( { ... error , location : this . file . path } )
253253 }
254254 logger . warn (
255255 `tsv file could not be opened by loadColumns '${ this . file . path } '` ,
@@ -272,8 +272,8 @@ export class BIDSContext implements Context {
272272 return
273273 }
274274 this . json = await loadJSON ( this . file ) . catch ( ( error ) => {
275- if ( error . key ) {
276- this . dataset . issues . add ( { code : error . key , location : this . file . path } )
275+ if ( error . code ) {
276+ this . dataset . issues . add ( { ... error , location : this . file . path } )
277277 return { }
278278 } else {
279279 throw error
@@ -320,9 +320,10 @@ export class BIDSContext implements Context {
320320 const participants_tsv = this . dataset . tree . get ( 'participants.tsv' ) as BIDSFile
321321 if ( participants_tsv ) {
322322 const participantsData = await loadTSV ( participants_tsv )
323- this . dataset . subjects . participant_id = participantsData [
324- 'participant_id'
325- ] as string [ ]
323+ . catch ( ( error ) => {
324+ return new Map ( )
325+ } ) as Record < string , string [ ] >
326+ this . dataset . subjects . participant_id = participantsData [ 'participant_id' ]
326327 }
327328
328329 // Load phenotype from phenotype/*.tsv
@@ -333,7 +334,10 @@ export class BIDSContext implements Context {
333334 const seen = new Set ( ) as Set < string >
334335 for ( const file of phenotypeFiles ) {
335336 const phenotypeData = await loadTSV ( file )
336- const participant_id = phenotypeData [ 'participant_id' ] as string [ ]
337+ . catch ( ( error ) => {
338+ return new Map ( )
339+ } ) as Record < string , string [ ] >
340+ const participant_id = phenotypeData [ 'participant_id' ]
337341 if ( participant_id ) {
338342 participant_id . forEach ( ( id ) => seen . add ( id ) )
339343 }
0 commit comments