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:
- Removes every widget element from the page.
- Dispatches
teak:erroron each widget element. - Calls
onErrorCbwith the session ID. It's called at most once until the widget loads successfully again. - Calls
optOutCbwith no context object, so a page that added the protection price on opt-in removes it. - 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.
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 yourconfigurecall is invalid. Fix them during development. The most common areE4026, a missingnameorreferenceNumber, andE4027, a missingevent.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.jsdidn't load, for example because it was blocked. Use the loader'sonerrorhandler 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
productTypesor a widget element'sid. 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:
- Look up any code in widget error codes, with its cause and fix.
- Handle the customer's choice to keep your order total right, keep the widget in step with the cart, and handle errors.
Updated 29 days ago
