mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
use generic openai error types but with specific codes
This commit is contained in:
1 parent
10ea68547c
commit
a474cd8cee
1 file changed
+3
-3
@@ -410,13 +410,13 @@ export class SessionManager {
|
||||
|
||||
// Convert provider errors to standard OpenAI APIError with appropriate code
|
||||
if (error?.status === 400) {
|
||||
throw new OpenAI.BadRequestError(400, { code: 'bad_request' }, error.message, new Headers());
|
||||
throw new OpenAI.APIError(400, { code: 'bad_request' }, error.message, new Headers());
|
||||
}
|
||||
if (error?.status === 403) {
|
||||
throw new OpenAI.PermissionDeniedError(403, { code: 'key_limit_exceeded' }, error.message, new Headers());
|
||||
throw new OpenAI.APIError(403, { code: 'key_limit_exceeded' }, error.message, new Headers());
|
||||
}
|
||||
if (error?.status === 422) {
|
||||
throw new OpenAI.UnprocessableEntityError(422, { code: 'unprocessable_entity' }, error.message, new Headers());
|
||||
throw new OpenAI.APIError(422, { code: 'unprocessable_entity' }, error.message, new Headers());
|
||||
}
|
||||
|
||||
// Re-throw service errors to be handled at the UI level
|
||||
|
||||
Reference in new issue
Block a user