Skip to content

Commit 81e4316

Browse files
committed
rf: Raise more issue-like objects for NIfTI
1 parent 65d0b22 commit 81e4316

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/files/nifti.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Deno.test('Test loading nifti header', async (t) => {
5151
const header = await loadHeader(file).catch((e) => {
5252
error = e
5353
})
54-
assertObjectMatch(error, { key: 'NIFTI_HEADER_UNREADABLE' })
54+
assertObjectMatch(error, { code: 'NIFTI_HEADER_UNREADABLE' })
5555
})
5656

5757
await t.step('Tolerate big headers', async () => {

src/files/nifti.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export async function loadHeader(file: BIDSFile): Promise<NiftiHeader> {
4545
header.readHeader(data.buffer)
4646
}
4747
if (!header) {
48-
throw { key: 'NIFTI_HEADER_UNREADABLE' }
48+
throw { code: 'NIFTI_HEADER_UNREADABLE' }
4949
}
5050
const ndim = header.dims[0]
5151
return {
@@ -67,6 +67,6 @@ export async function loadHeader(file: BIDSFile): Promise<NiftiHeader> {
6767
sform_code: header.sform_code,
6868
} as NiftiHeader
6969
} catch (err) {
70-
throw { key: 'NIFTI_HEADER_UNREADABLE' }
70+
throw { code: 'NIFTI_HEADER_UNREADABLE' }
7171
}
7272
}

src/schema/context.ts

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

0 commit comments

Comments
 (0)