jan/web/utils/errorMessage.ts

16 lines
388 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { ErrorCode } from '@janhq/core'
export const getErrorTitle = (
errorCode: ErrorCode,
errorMessage: string | undefined
) => {
switch (errorCode) {
case ErrorCode.Unknown:
return 'Apologies, somethings amiss!'
case ErrorCode.InvalidApiKey:
return 'Invalid API key. Please check your API key and try again.'
default:
return errorMessage
}
}