mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 14:11:20 +00:00
* TEC-252: Base integration with commercetools using fetchers for REST and GraphQL endpoints * TEC-252: WIP commenting some components that are failing while we don't have all the hooks defined * add sdk integration * TEC-256: Implementing product search * TEC-256: removing unnecessary env variables * TEC-256: review comments * TEC-256: other remaining review fixes Co-authored-by: nicossosa93 <nicolas.sosa@devgurus.io>
26 lines
564 B
TypeScript
26 lines
564 B
TypeScript
import type { Response } from '@vercel/fetch'
|
|
|
|
// Used for GraphQL errors
|
|
export class CommercetoolsGraphQLError extends Error {}
|
|
|
|
export class CommercetoolsApiError extends Error {
|
|
status: number
|
|
res: Response
|
|
data: any
|
|
|
|
constructor(msg: string, res: Response, data?: any) {
|
|
super(msg)
|
|
this.name = 'CommercetoolsApiError'
|
|
this.status = res.status
|
|
this.res = res
|
|
this.data = data
|
|
}
|
|
}
|
|
|
|
export class CommercetoolsNetworkError extends Error {
|
|
constructor(msg: string) {
|
|
super(msg)
|
|
this.name = 'CommercetoolsNetworkError'
|
|
}
|
|
}
|