Skip to content

Commit d0c3f21

Browse files
committed
fix tests
1 parent fd4e43b commit d0c3f21

File tree

1 file changed

+6
-2
lines changed
  • src/app/(backend)/middleware/auth

1 file changed

+6
-2
lines changed

src/app/(backend)/middleware/auth/index.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,18 @@ export const checkAuth =
4848
nextAuthAuthorized: oauthAuthorized,
4949
});
5050
} catch (e) {
51+
const params = await options.params;
52+
5153
// if the error is not a ChatCompletionErrorPayload, it means the application error
5254
if (!(e as ChatCompletionErrorPayload).errorType) {
5355
if ((e as any).code === 'ERR_JWT_EXPIRED')
5456
return createErrorResponse(ChatErrorType.SystemTimeNotMatchError, e);
5557

5658
// other issue will be internal server error
57-
return createErrorResponse(ChatErrorType.InternalServerError, e);
59+
return createErrorResponse(ChatErrorType.InternalServerError, {
60+
error: e,
61+
provider: params?.provider,
62+
});
5863
}
5964

6065
const {
@@ -65,7 +70,6 @@ export const checkAuth =
6570

6671
const error = errorContent || e;
6772

68-
const params = await options.params;
6973
return createErrorResponse(errorType, { error, ...res, provider: params?.provider });
7074
}
7175

0 commit comments

Comments
 (0)