Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.d/20250918_173356_yarikoptic_enh_crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Changed

- Throw an error if specified schema (e.g. via `--schema` or `BIDS_SCHEMA` env
var) could not be loaded.
7 changes: 3 additions & 4 deletions src/setup/loadSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { setCustomMetadataFormats } from '../validators/json.ts'
/**
* Load the schema from the specification
*
* version is ignored when the network cannot be accessed
*/
export async function loadSchema(version?: string): Promise<Schema> {
let schemaUrl = version
Expand All @@ -31,10 +30,10 @@ export async function loadSchema(version?: string): Promise<Schema> {
objectPathHandler,
) as Schema
} catch (error) {
// No network access or other errors
// If a custom schema URL was explicitly provided, fail rather than falling back
console.error(error)
console.error(
`Warning, could not load schema from ${schemaUrl}, falling back to internal version`,
throw new Error(
`Failed to load schema from ${schemaUrl}: ${error instanceof Error ? error.message : String(error)}`,
)
}
}
Expand Down
Loading