@pfantato/printful-ts
Version:
Typescript SDK to integrate with Printful
29 lines (28 loc) • 829 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrintfulError = exports.PrintfulErrorCode = void 0;
const zod_1 = require("zod");
exports.PrintfulErrorCode = zod_1.z.enum([
'SCHEMA_ERROR',
'REQUEST_ERROR',
'API_ERROR',
'NOT_FOUND',
'UNAUTHORIZED',
'FORBIDDEN',
'SERVICE_UNAVAILABLE',
'BAD_REQUEST',
'TOO_MANY_REQUESTS',
'PAYMENT_REQUIRED',
'PRECONDITION_FAILED',
'INTERNAL_SERVER_ERROR',
]);
class PrintfulError extends Error {
constructor(message, code = exports.PrintfulErrorCode.Enum.INTERNAL_SERVER_ERROR) {
super(message);
this.name = 'PrintfulError';
this.code = code;
this.message = message;
Object.setPrototypeOf(this, PrintfulError.prototype);
}
}
exports.PrintfulError = PrintfulError;