Files
klz-cables.com/.pnpm-store/v10/files/e6/2be38427e74c841585e0a23bd5c81d5b5877a48f45d9cebff238a08894713afc1db4617ffbc9e3148afe3b50f0eb32011abd60a278729bfcc5fcf0d28107c5
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

39 lines
1.4 KiB
Plaintext

import { status as httpStatus } from 'http-status';
// This gets dynamically reassigned during compilation
export let APIErrorName = 'APIError';
class ExtendableError extends Error {
data;
isOperational;
isPublic;
status;
constructor(message, status, data, isPublic){
super(message, {
// show data in cause
cause: data
});
APIErrorName = this.constructor.name;
this.name = this.constructor.name;
this.message = message;
this.status = status;
this.data = data;
this.isPublic = isPublic;
this.isOperational = true; // This is required since bluebird 4 doesn't append it anymore.
Error.captureStackTrace(this, this.constructor);
}
}
/**
* Class representing an API error.
* @extends ExtendableError
*/ export class APIError extends ExtendableError {
/**
* Creates an API error.
* @param {string} message - Error message.
* @param {number} status - HTTP status code of error.
* @param {object} data - response data to be returned.
* @param {boolean} isPublic - Whether the message should be visible to user or not.
*/ constructor(message, status = httpStatus.INTERNAL_SERVER_ERROR, data = null, isPublic){
super(message, status, data, typeof isPublic === 'boolean' ? isPublic : status !== httpStatus.INTERNAL_SERVER_ERROR);
}
}
//# sourceMappingURL=APIError.js.map