Files
klz-cables.com/.pnpm-store/v10/files/99/84e08aad99aab08a664d0fe897694c7e798880c5a6effe16173499165efa2e8c6d487a0bcfe9c45321ff51e9bd9ccb24249cf8d6998abb999cc5826bff3b29
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

44 lines
1.5 KiB
Plaintext

export let ErrorCode = /* @__PURE__ */ function(ErrorCode) {
// When we have a placeholder but no value to format
ErrorCode["MISSING_VALUE"] = "MISSING_VALUE";
// When value supplied is invalid
ErrorCode["INVALID_VALUE"] = "INVALID_VALUE";
// When we need specific Intl API but it's not available
ErrorCode["MISSING_INTL_API"] = "MISSING_INTL_API";
return ErrorCode;
}({});
export class FormatError extends Error {
code;
/**
* Original message we're trying to format
* `undefined` if we're only dealing w/ AST
*
* @type {(string | undefined)}
* @memberof FormatError
*/
originalMessage;
constructor(msg, code, originalMessage) {
super(msg);
this.code = code;
this.originalMessage = originalMessage;
}
toString() {
return `[formatjs Error: ${this.code}] ${this.message}`;
}
}
export class InvalidValueError extends FormatError {
constructor(variableId, value, options, originalMessage) {
super(`Invalid values for "${variableId}": "${value}". Options are "${Object.keys(options).join("\", \"")}"`, ErrorCode.INVALID_VALUE, originalMessage);
}
}
export class InvalidValueTypeError extends FormatError {
constructor(value, type, originalMessage) {
super(`Value for "${value}" must be of type ${type}`, ErrorCode.INVALID_VALUE, originalMessage);
}
}
export class MissingValueError extends FormatError {
constructor(variableId, originalMessage) {
super(`The intl string context variable "${variableId}" was not provided to the string "${originalMessage}"`, ErrorCode.MISSING_VALUE, originalMessage);
}
}