SubblySubbly
Log inGet started
  • Get started
  • Developer resources
Developer resources
Subbly.js SDK
    InstallConfigureKeep it up to dateBuild a checkoutHandle errorsRun a funnel
SubblyCart.js widget
    InstallConfigureKeep it up to dateWire it into your pageDrive it from your codeStyle it
Subbly.js SDK

Handle errors

A failed request rejects with a plain object carrying a code, not an Error.

Read the error code
try { await subbly.cart.addItem({ productId: 3301 }) } catch (error) { if (error.code === 'out_of_stock') { // tell the customer } }

The full list of codes is on the Subbly.js SDK reference.

Last modified on September 14, 2026
Javascript