Skip to content
Clone
c8e7827
17 lines 440 B
import { isMessageKey, t } from '@/shared/i18n'
export function errorMessage(code: string): string | undefined {
const key = `error.${code}`
return isMessageKey(key) ? t(key) : undefined
}
export class AuthError extends Error {
code: string
retryAfter: number
constructor(code: string, message: string, retryAfter = 0) {
super(message)
this.name = 'AuthError'
this.code = code
this.retryAfter = retryAfter
}
}