Errors

What happens when the widget fails, the messages it logs, and what to do.

The widget is designed to fail safely: when something goes wrong, it removes itself so the customer can check out without protection.

What happens on an error

When the widget can't load, or can't save the customer's choice, it:

  1. Removes every widget element from the page.
  2. Dispatches teak:error on each widget element.
  3. Calls onErrorCb with the session ID. It's called at most once until the widget loads successfully again.
  4. Calls optOutCb with no context object, so a page that added the protection price on opt-in removes it.
  5. Logs a message with an error code to the browser console.

Let the customer complete checkout without protection, and don't submit that order to Teak. Never block checkout because the widget failed. The widget has already taken the protection price out of the order total through optOutCb, so skip Submit an order for that checkout.

Error codes appear only in the browser console

Your callbacks don't receive them, so use the console, or your own error logging, when debugging.

Error codes

Each code has its own page with the exact message, the cause, and how to fix it: see Widget error codes.

  • Configuration errors (E4010–E4027) mean your configure call is invalid. Fix them during development. The most common are E4026, a missing name or referenceNumber, and E4027, a missing event.location.
  • Runtime errors (E4001–E4004) happen while the widget runs. They're usually temporary, and there's nothing to fix in your code. After one, let the customer check out without protection, and skip Submit an order for that checkout.

One configuration problem has no code: if no widget element is on the page when configure runs, the widget reports an error without one. Add a <teak-widget> to the page before calling configure.

When there's no error but no offer

In a few cases the widget shows nothing without calling onErrorCb:

  • teak.js didn't load, for example because it was blocked. Use the loader's onerror handler to detect this. See Installation.
  • Your account has no protection offer for this cart, for example because the items can't be covered.
  • An item's product type isn't mapped for your account, from its productTypes or a widget element's id. Ask your Teak integration contact to map it. See Product types.

So don't rely on onErrorCb alone. Add protection to the order only when optInCb fires, and treat "no loadedCb" as "no offer".

Next steps

To look up a code, or handle failures in your checkout:


Did this page help you?