This repository has been archived on 2022-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
gosh-commerce/framework/commerce/api/utils/errors.ts
2021-09-11 22:49:44 +00:00

23 lines
460 B
TypeScript

import type { Response } from '@vercel/fetch'
export class CommerceAPIError extends Error {
status: number
res: Response
data: any
constructor(msg: string, res: Response, data?: any) {
super(msg)
this.name = 'CommerceApiError'
this.status = res.status
this.res = res
this.data = data
}
}
export class CommerceNetworkError extends Error {
constructor(msg: string) {
super(msg)
this.name = 'CommerceNetworkError'
}
}