Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function statusToError(e: any) {
if (!e.response) {
throw e
}
const { response } = e as AxiosError
const { status } = response!
if (status === 401) {
throw new AuthenticationError(e)
}
if (status === 403) {
throw new ForbiddenError(e)
}
if (status === 400) {
throw new UserInputError(e)
}
throw e
}
export function statusToError(e: any) {
if (!e.response) {
throw e
}
const { response } = e as AxiosError
const { status } = response!
if (status === 401) {
throw new AuthenticationError(e)
}
if (status === 403) {
throw new ForbiddenError(e)
}
if (status === 400) {
throw new UserInputError(e)
}
throw e
}