WidgetsBooking widget

Booking widget errors

How MedosBooking reports failures — config mistakes that throw from init(), start-up failures that reach onError, and in-flow errors it handles itself.

Failures split three ways, and only one of them reaches onError.

What went wrongHow you see itExample
Bad configinit() throws synchronously"API key is required"
Widget can't startonError(error)Workspace lookup rejected the key
Something failed mid-flowThe widget's own inline error UIA wrong OTP code, a rejected booking

Config mistakes throw

These are raised synchronously by init(), so catch them with try/catch — onError will never see them:

Thrown messageCause
API key is requiredNo apiKey passed.
containerId is required for inline modeInline mode without a container.
Container with id "X" not foundInline mode, missing DOM node.
try {
  MedosBooking.init({ apiKey: "mk_...", mode: "inline", containerId: "book" });
} catch (err) {
  console.error("Medos Booking failed to start:", err);
}

Start-up failures call onError

What reaches onError is the workspace-load or session-exchange failure, carrying the API's own message. The widget renders its own error UI either way.

In-flow failures stay inside the widget

A failed verification code or a rejected booking shows the widget's own inline error UI without calling onError.

A script that fails to load

If the script tag itself fails to load — a Content Security Policy that doesn't allow widgets.medos.one, an ad blocker, a network error — then window.MedosBooking is never defined and calling init() throws a TypeError on undefined. Check the Network tab before debugging your config.

For more symptoms and fixes, see Troubleshooting.

On this page