fix(init): rethrow plugin activation failures with the original error as cause so the originating frame survives to the caller
This commit is contained in:
parent
4c7b0fab7a
commit
2496e09aeb
1 changed files with 5 additions and 1 deletions
|
|
@ -1815,7 +1815,11 @@ export class Brainy<T = any> implements BrainyInterface<T> {
|
|||
if (error instanceof Error && (error as Error & { code?: string }).code === 'BRAINY_WRITER_LOCKED') {
|
||||
throw error
|
||||
}
|
||||
throw new Error(`Failed to initialize Brainy: ${error}`)
|
||||
// Wrap with the original as `cause` so the originating frame (a plugin's
|
||||
// own file:line, e.g. a provider boot failure) survives to the caller's
|
||||
// log — a plain string interpolation discards both stack and cause.
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
throw new Error(`Failed to initialize Brainy: ${message}`, { cause: error })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue