Errors
Canonical errors are thrown by action handlers when an operation fails in a predictable way. Your connector app should throw these errors so the frontend can handle them consistently (e.g., show a form validation message or a stock warning).
Import these from @laioutr-core/canonical-types/ecommerce.
Auth
InvalidCredentialsError
AUTH_INVALID_CREDENTIALS401Thrown when authentication with the provided credentials fails.
UnauthenticatedError
AUTH_UNAUTHENTICATED401Thrown when the user tries to access a resource that requires authentication.
CustomerDisabledError
AUTH_CUSTOMER_DISABLED403Thrown when a customer that is trying to login is disabled.
Cart
ProductNotFoundError
CART_PRODUCT_NOT_FOUND404Thrown when a product that should be added to the cart is not found.
variantIdstringProductStockError
CART_PRODUCT_STOCK_ERRORThrown when a product cannot be added to the cart due to stock issues.
variantIdstringreasonProductStockErrorReasonOUT_OF_STOCKNOT_ENOUGH_STOCKProductQuantityError
CART_PRODUCT_QUANTITY_ERRORThrown when an item cannot be added to the cart due to quantity constraints.
variantIdstringreasonProductQuantityErrorReasonMINIMUM_NOT_METMAXIMUM_EXCEEDEDINVALID_INCREMENTDiscountCodeNotFoundError
CART_DISCOUNT_CODE_NOT_FOUND404Thrown when a discount code that should be added to the cart is not found.
codestringDiscountCodeNotRedeemableError
CART_DISCOUNT_CODE_NOT_REDEEMABLEThrown when a discount code cannot be applied to the cart.
codestringreasonDiscountCodeNotRedeemableErrorReasonCODE_NOT_HONOUREDCURRENTLY_INACTIVECUSTOMER_NOT_ELIGIBLECUSTOMER_USAGE_LIMIT_REACHEDELIGIBLE_CUSTOMER_MISSINGINCOMPATIBLE_PURCHASE_TYPENO_ENTITLED_LINE_ITEMSNO_ENTITLED_SHIPPING_LINESPURCHASE_NOT_IN_RANGEQUANTITY_NOT_IN_RANGEUSAGE_LIMIT_REACHEDOTHERCustomer
AddressNotFoundError
CUSTOMER_ADDRESS_NOT_FOUND404Thrown when an address with the given ID is not found.
idstringInvalidFieldError
INVALID_FIELDThrown when a field in the input is invalid. Use for backend-system validation errors when no more specific error applies.
reasonInvalidFieldErrorReasonfieldstring[]Path to the invalid fieldMISSINGTOO_LONGTOO_SHORTINVALID_FORMATINVALID_VALUEProduct
CategoryNotFoundError
CATEGORY_NOT_FOUND404Thrown when a category with the given ID is not found.
idstringProduct lists
ProductListNotFoundError
PRODUCT_LIST_NOT_FOUND404Thrown when a product list is not found or is not visible to the current customer.
idstringProductListItemNotFoundError
PRODUCT_LIST_ITEM_NOT_FOUND404Thrown when a product is not present on the specified product list.
idstringProduct-list IDproductIdstringvariantIdstringOrders
OrderNotFoundError
ORDER_NOT_FOUND404Thrown when an order is not found or is not visible to the current customer.
idstringOrderNotCancellableError
ORDER_NOT_CANCELLABLEThrown when the current order state does not allow cancellation.
idstringstatusWellKnownOrderStatusDocuments
DocumentNotFoundError
DOCUMENT_NOT_FOUND404Thrown when a document is not found or is not visible to the current customer.
idstring