Skip to content

Commit

Permalink
fix: handle error message when apikey is not setup (janhq#3149)
Browse files Browse the repository at this point in the history
  • Loading branch information
urmauur authored and louis-jan committed Jul 12, 2024
1 parent 40dd0ca commit eac415a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions core/src/types/message/messageEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export enum MessageStatus {
export enum ErrorCode {
InvalidApiKey = 'invalid_api_key',

AuthenticationError = 'authentication_error',

InsufficientQuota = 'insufficient_quota',

InvalidRequestError = 'invalid_request_error',
Expand Down
5 changes: 3 additions & 2 deletions web/containers/ErrorMessage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
case ErrorCode.Unknown:
return 'Apologies, something’s amiss!'
case ErrorCode.InvalidApiKey:
case ErrorCode.AuthenticationError:
case ErrorCode.InvalidRequestError:
return (
<span data-testid="invalid-API-key-error">
Invalid API key. Please check your API key from{' '}
<button
className="font-medium text-[hsla(var(--app-link))]"
className="font-medium text-[hsla(var(--app-link))] underline"
onClick={() => {
setMainState(MainViewState.Settings)

Expand Down Expand Up @@ -102,7 +103,7 @@ const ErrorMessage = ({ message }: { message: ThreadMessage }) => {
<p>
Jan’s in beta. Access&nbsp;
<span
className="cursor-pointer text-[hsla(var(--app-link))]"
className="cursor-pointer text-[hsla(var(--app-link))] underline"
onClick={() => setModalTroubleShooting(true)}
>
troubleshooting assistance
Expand Down

0 comments on commit eac415a

Please sign in to comment.