File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -85,24 +85,26 @@ export async function run(): Promise<void> {
85
85
// Extract x-ms-error-code from headers if available
86
86
const errorCode = response . headers [ 'x-ms-error-code' ]
87
87
const errorCodeMsg = errorCode ? ` (error code: ${ errorCode } )` : ''
88
-
88
+
89
89
// Check if response body exists and contains error details
90
90
if ( response . body && response . body . error ) {
91
91
throw response . body . error
92
92
}
93
-
93
+
94
94
// Handle case where response body is missing
95
95
if ( ! response . body ) {
96
96
throw new Error (
97
97
`Failed to get response from AI service (status: ${ response . status } )${ errorCodeMsg } . ` +
98
- 'Please check network connection and endpoint configuration.'
98
+ 'Please check network connection and endpoint configuration.'
99
99
)
100
100
}
101
-
101
+
102
102
// Handle other error cases
103
103
throw new Error (
104
104
`AI service returned error response (status: ${ response . status } )${ errorCodeMsg } : ` +
105
- ( typeof response . body === 'string' ? response . body : JSON . stringify ( response . body ) )
105
+ ( typeof response . body === 'string'
106
+ ? response . body
107
+ : JSON . stringify ( response . body ) )
106
108
)
107
109
}
108
110
You can’t perform that action at this time.
0 commit comments