Skip to main content

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

FieldTypeDescription
errorError | unknownThe 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.

Payload: AppConfigErrorEventPayload

FieldTypeDescription
errorError | unknownThe thrown error object from the failed fetch
type'embed_data' | 'customer_data'Identifies which JSON configuration file failed to load
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

FieldTypeDescription
errorError | unknownThe thrown error object from the failed network request
requestPathstring (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);
});