File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,10 @@ function extractUsageAndCost(usage: any): UsageData {
4545 }
4646}
4747
48- function extractRequestMetadataWithN ( params : { body : unknown ; logger : Logger } ) {
48+ function extractRequestMetadataWithN ( params : {
49+ body : unknown
50+ logger : Logger
51+ } ) {
4952 const { body, logger } = params
5053 const { clientId, clientRequestId } = extractRequestMetadata ( { body, logger } )
5154 const n = ( body as any ) ?. codebuff_metadata ?. n
@@ -180,7 +183,9 @@ export async function handleOpenRouterNonStream({
180183 } )
181184
182185 if ( ! response . ok ) {
183- throw new Error ( `OpenRouter API error: ${ response . statusText } ` )
186+ throw new Error (
187+ `OpenRouter API error (${ response . statusText } ): ${ await response . text ( ) } ` ,
188+ )
184189 }
185190
186191 const data = await response . json ( )
@@ -256,7 +261,9 @@ export async function handleOpenRouterStream({
256261 } )
257262
258263 if ( ! response . ok ) {
259- throw new Error ( `OpenRouter API error: ${ response . statusText } ` )
264+ throw new Error (
265+ `OpenRouter API error (${ response . statusText } ): ${ await response . text ( ) } ` ,
266+ )
260267 }
261268
262269 const reader = response . body ?. getReader ( )
You can’t perform that action at this time.
0 commit comments