Skip to main content

Error Events

Error events track failures during the initialization and data fetching of the Mimeeq <mmq-embed> element. These events are dispatched on document and bubble to window, allowing you to catch template, configuration, and API failures.

Error Flow​

<mmq-embed> component loads
│
▼
mimeeq-app-loaded
│
▼
┌─── Initialization / Loading ─────────────────────────────────┐
│ │
│ Fetching Template: │
│ (success) ──► Template applied │
│ (fail) ──► mimeeq-app-template-error │
│ │
│ Fetching embed and account data: │
│ (success) ──► Config loaded │
│ (fail) ──► mimeeq-app-config-error │
│ │
│ Fetching API Data (observers): │
│ (success) ──► Observer data processed │
│ (fail) ──► mimeeq-api-error │
└──────────────────────────────────────────────────────────────┘

Events​

mimeeq-app-template-error​

Fires if the template identifier provided to the <mmq-embed> element cannot be loaded. If the template doesn't exist or fails to load, the embed component will stop loading and this event will fire.

This also fires if a Custom UI template (associated with the customUiId inside the embed template) fails to load.

Payload: AppTemplateErrorEventPayload

FieldTypeDescription
errorunknownFailure value. It can be an error object, message or other value.
document.addEventListener('mimeeq-app-template-error', (event) => {
const { error } = event.detail;
console.error('Failed to load Mimeeq template:', error);
fallbackToDefaultImage();
});

mimeeq-app-config-error​

Fires when the short code is missing or the embed cannot load its configuration or account data.

It also fires once with type: 'embed_data' when a standard or modular embed cannot load its primary product after the existing CDN/API fallback completes, including unavailable or inactive products, a gateway error, a reply without usable product data, and a product that fails while it is being prepared. A CDN miss or an unusable CDN read model followed by a successful API response does not report an error. Cancelled and superseded product requests do not report an error. After a failed load the loader ends its loading state, does not mark the product as loaded and does not reject, so opening the product again can succeed.

Runtime script failures emit type: 'embed' (Shopify: APP_NOT_LOADING). Observing a failed script does not settle its existing loading promise or start a retry. Custom UI asset failures and metadata with no usable version emit mimeeq-app-template-error without changing template/loading gates.

Payload: MimeeqEventMap entry for mimeeq-app-config-error

FieldTypeDescription
errorError | unknownThe failure value reported by the embed
type'embed_data' | 'customer_data' | 'short_code' | 'embed'Identifies the configuration, shortcode or runtime failure
reasonAppConfigErrorReason, optionalStable code for selecting a host message. Older emitters may omit it.
statusnumber, optionalHTTP response status, when available for the failure.
ReasonWhen it happensWhat a custom UI can dostatus
short_code_missingThe embed starts without a short-code.Check the embed markup or product mapping.Absent
short_code_not_foundThe embed-data lookup returns HTTP 404 or the CDN's missing-file HTTP 403 response.Check that the short code is correct and published.404 or 403
customer_not_foundThe account-data lookup returns HTTP 403 or 404, or validation finds no account data.Show an unavailable message and ask the site operator to verify the embed setup.403 or 404 if returned
customer_inactiveThe account has a status other than ACTIVE.Show an unavailable message and refer the issue to the site operator.Absent
customer_data_invalidThe account response could not be parsed as JSON.Show an unavailable message and report the failed setup.Absent
product_not_foundThe product API explicitly reports that the product was not found.Show an unavailable message and check that the product is published.The HTTP status if available
product_data_invalidA successful product API reply has no usable product data.Show a fallback and report the data issue.Absent
embed_data_invalidThe embed-data response is empty, malformed JSON, or has no usable embed variant.Check the embed setup and report a persistent failure.Absent
http_4xxThe request received an HTTP 4xx response without a more specific reason.Use the status to check the setup and permissions. Offer a retry for a temporary response such as 429.The HTTP status
http_5xxThe request received an HTTP 5xx response.Offer a retry and report persistent failures.The HTTP status
offlineThe request or runtime asset failed and the browser reported it was offline.Ask the visitor to reconnect before trying again.Absent
networkThe browser reported a transport or asset failure without an accessible response. This includes CORS failures and blocked requests.Offer a retry. If the request keeps failing, check network access and site policies.Absent
timeoutThe product request reported a timeout.Offer a retry.Absent
unknownThe available failure information does not establish a more specific reason.Show a generic fallback and record the error for diagnosis.Present if an HTTP status was available

Listen on the embed element before setup starts to handle failures even when the API is unavailable. Once installed, window.mimeeqApp.observers.status.loadError.getValue() returns { type, reason, status? } or null. When whenReady() rejects on setup failure, it passes through the same failure value, with reason and an available status attached to an error object that can carry them. A browser script error event does not expose the HTTP status.

const embed = document.querySelector('mmq-embed');
embed.addEventListener('mimeeq-app-config-error', (event) => {
const { error, type, reason = 'unknown', status } = event.detail;
console.error('Mimeeq load failed', { type, reason, status, error });
});

mimeeq-api-error​

Fires when an existing fetch/observer request or a shared Axios service request fails. Shared services also include requests made by the admin application. Ignored failures and cancellations do not emit it. The canonical name is mimeeq-api-error; mimeeq-app-api-error is not an alias.

The native event bubbles from document to window; it is not forwarded to a parent frame. Existing fetch errors retain their unknown error value. Shared Axios failures expose a scalar error message and optional status/code metadata, without headers or raw request configuration.

Payload: AppApiErrorEventPayload

FieldTypeDescription
errorError | unknownExisting fetch error value, or scalar Axios error message
requestPathstring (optional)The API path that failed
statusnumber (optional)Axios HTTP status, 504 for timeout, or 0 when unknown
codestring (optional)Axios error code, when available
document.addEventListener('mimeeq-api-error', (event) => {
const { error, requestPath } = event.detail;
console.warn(`Mimeeq API call to ${requestPath} failed:`, error);
});