Ecommerce

Errors

Canonical error types for ecommerce connector apps

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_CREDENTIALS401

Thrown when authentication with the provided credentials fails.

UnauthenticatedError

AUTH_UNAUTHENTICATED401

Thrown when the user tries to access a resource that requires authentication.

CustomerDisabledError

AUTH_CUSTOMER_DISABLED403

Thrown when a customer that is trying to login is disabled.

Cart

ProductNotFoundError

CART_PRODUCT_NOT_FOUND404

Thrown when a product that should be added to the cart is not found.

variantIdstring

ProductStockError

CART_PRODUCT_STOCK_ERROR

Thrown when a product cannot be added to the cart due to stock issues.

variantIdstring
reasonProductStockErrorReason
OUT_OF_STOCKNOT_ENOUGH_STOCK

ProductQuantityError

CART_PRODUCT_QUANTITY_ERROR

Thrown when an item cannot be added to the cart due to quantity constraints.

variantIdstring
reasonProductQuantityErrorReason
MINIMUM_NOT_METMAXIMUM_EXCEEDEDINVALID_INCREMENT

DiscountCodeNotFoundError

CART_DISCOUNT_CODE_NOT_FOUND404

Thrown when a discount code that should be added to the cart is not found.

codestring

DiscountCodeNotRedeemableError

CART_DISCOUNT_CODE_NOT_REDEEMABLE

Thrown when a discount code cannot be applied to the cart.

codestring
reasonDiscountCodeNotRedeemableErrorReason
CODE_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_REACHEDOTHER

Customer

AddressNotFoundError

CUSTOMER_ADDRESS_NOT_FOUND404

Thrown when an address with the given ID is not found.

idstring

InvalidFieldError

INVALID_FIELD

Thrown when a field in the input is invalid. Use for backend-system validation errors when no more specific error applies.

reasonInvalidFieldErrorReason
fieldstring[]Path to the invalid field
MISSINGTOO_LONGTOO_SHORTINVALID_FORMATINVALID_VALUE

Product

CategoryNotFoundError

CATEGORY_NOT_FOUND404

Thrown when a category with the given ID is not found.

idstring