Error Events
Error events track failures during the intialization and data fetching of the Mimeeq <mmq-embed> element. These events are dispatched on document, allowing you to catch errors related to templates, JSON configurations, and missing or failing API requests from observers.
Error Flow
<mmq-embed> component loads
│
▼
mimeeq-app-loaded
│
▼
┌─── Initialization / Loading ─────────────────────────────────┐
│ │
│ Fetching Template: │
│ (success) ──► Template applied │
│ (fail) ──► mimeeq-app-template-error │
│ │
│ Fetching Configs (embed_data, customers): │
│ (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
| Field | Type | Description |
|---|---|---|
error | Error | unknown | The thrown error object from the failed fetch |
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 if the embed_data or customers configuration JSON files fail to load. These files rely on the short-code passed to the embed. Without them, the configurator cannot render.
It also fires 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 CDN miss followed by a successful API response does not report an error. Cancelled and superseded product requests do not report an error. Reporting does not change the product loader's return values, loading states, or preview behavior. Standard-product preparation errors are also reported while preserving their original rejection.
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: AppConfigErrorEventPayload
| Field | Type | Description |
|---|---|---|
error | Error | unknown | The thrown error object from the failed fetch |
type | 'embed_data' | 'customer_data' | 'short_code' | 'embed' | Identifies the configuration, shortcode or runtime failure |
document.addEventListener('mimeeq-app-config-error', (event) => {
const { error, type } = event.detail;
console.error(`Failed to load ${type} config:`, error);
});
mimeeq-api-error
Fires when an internal Mimeeq API call made by an observer (or via the makeRequest helper) fails. This catches network errors or failing requests when data is required for the configurator to function or update.
Payload: AppApiErrorEventPayload
| Field | Type | Description |
|---|---|---|
error | Error | unknown | The thrown error object from the failed network request |
requestPath | string (optional) | The API path that failed |
document.addEventListener('mimeeq-api-error', (event) => {
const { error, requestPath } = event.detail;
console.warn(`Observer API call to ${requestPath} failed:`, error);
});
Related
- Lifecycle Events — for
mimeeq-app-loadedand normal initialization flows - Architecture Overview — to understand how observers relate to events