File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -512,10 +512,13 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
512512function makeOpenRouterErrorReadable ( error : any ) {
513513 const metadata = error ?. error ?. metadata as { raw ?: string ; provider_name ?: string } | undefined
514514 const parsedJson = safeJsonParse ( metadata ?. raw )
515- const rawError = parsedJson as { error ?: string & { message ?: string } ; detail ?: string } | undefined
515+ const rawError = parsedJson as
516+ | { error ?: string & { message ?: string } ; detail ?: string ; message ?: string }
517+ | undefined
516518
517519 if ( error ?. code !== 429 && error ?. code !== 418 ) {
518- const errorMessage = rawError ?. error ?. message ?? rawError ?. error ?? rawError ?. detail ?? error ?. message
520+ const errorMessage =
521+ rawError ?. error ?. message ?? rawError ?. error ?? rawError ?. detail ?? rawError ?. message ?? error ?. message
519522 throw new Error ( `${ metadata ?. provider_name ?? "Provider" } error: ${ errorMessage ?? "unknown error" } ` )
520523 }
521524
You can’t perform that action at this time.
0 commit comments