85 lines
2.1 KiB
TypeScript
85 lines
2.1 KiB
TypeScript
export const COMMERCE_ERRORS = {
|
|
PRODUCT_NOT_FOUND: [404, 'Product not found', 'Scoped product lookup failed'],
|
|
PRODUCT_NOT_PUBLISHABLE: [
|
|
409,
|
|
'Add an active priced variant before publishing',
|
|
'Product publish eligibility failed',
|
|
],
|
|
PRODUCT_ARCHIVED: [
|
|
409,
|
|
'Archived products cannot be edited',
|
|
'Archived product mutation rejected',
|
|
],
|
|
VARIANT_NOT_FOUND: [
|
|
404,
|
|
'Product variant not found',
|
|
'Scoped product variant lookup failed',
|
|
],
|
|
VARIANT_LIMIT: [
|
|
409,
|
|
'Product variant limit reached',
|
|
'Variant resource quota exceeded',
|
|
],
|
|
VARIANT_REQUIRED: [
|
|
409,
|
|
'A published product needs an active variant',
|
|
'Last sellable variant deactivation rejected',
|
|
],
|
|
GROUP_NOT_FOUND: [
|
|
404,
|
|
'Catalogue group not found',
|
|
'Scoped catalogue group lookup failed',
|
|
],
|
|
ADDRESS_NOT_FOUND: [
|
|
404,
|
|
'Address not found',
|
|
'Private address lookup failed',
|
|
],
|
|
ADDRESS_LIMIT: [
|
|
409,
|
|
'Address limit reached',
|
|
'Account address quota exceeded',
|
|
],
|
|
WAREHOUSE_NOT_FOUND: [
|
|
404,
|
|
'Warehouse not found',
|
|
'Scoped warehouse lookup failed',
|
|
],
|
|
STOCK_NOT_FOUND: [404, 'Stock item not found', 'Scoped stock lookup failed'],
|
|
STOCK_INSUFFICIENT: [
|
|
409,
|
|
'Insufficient available stock',
|
|
'Inventory availability check rejected operation',
|
|
],
|
|
STOCK_CAPACITY: [
|
|
409,
|
|
'Stock balance limit would be exceeded',
|
|
'Inventory integer bound rejected operation',
|
|
],
|
|
IDEMPOTENCY_CONFLICT: [
|
|
409,
|
|
'Idempotency key was used for a different request',
|
|
'Idempotency payload mismatch',
|
|
],
|
|
RESERVATION_NOT_FOUND: [
|
|
404,
|
|
'Stock reservation not found',
|
|
'Scoped reservation lookup failed',
|
|
],
|
|
RESERVATION_EXPIRED: [
|
|
409,
|
|
'Stock reservation has expired',
|
|
'Expired reservation commit rejected',
|
|
],
|
|
RESERVATION_CLOSED: [
|
|
409,
|
|
'Stock reservation is already closed',
|
|
'Invalid reservation state transition',
|
|
],
|
|
PRODUCT_UNAVAILABLE: [
|
|
409,
|
|
'Product variant is not available for reservation',
|
|
'Non-sellable variant reservation rejected',
|
|
],
|
|
} as const;
|