Skip to content

Commit 65d0b22

Browse files
committed
rf: Swallow TSV reading errors when initializing dataset
1 parent 14e7e75 commit 65d0b22

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/schema/context.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)