handle 422s and surface to quilly

This commit is contained in:
sam committed 2025-09-27 18:08:17 +07:00
1 parent 1a9a553523
commit 185cdc51fb
2 files changed
+20

No files matched your search

+11
View File
@@ -408,6 +408,17 @@ export class SessionManager {
return; // User cancelled
}
// Convert UnprocessableEntityError to standard OpenAI APIError with code
if (error?.constructor?.name === 'UnprocessableEntityError') {
const apiError = new OpenAI.APIError({
status: 422,
code: 'unprocessable_entity',
message: '422 Provider returned error'
});
apiError.code = 'unprocessable_entity';
throw apiError;
}
// Re-throw service errors to be handled at the UI level
throw error;
} finally {