React Native
Error Handling
Learn how to handle errors in your Muta placements
Error Handling
Muta will automatically handle errors and prevent the flow from displaying if there are any issues. You can listen for these errors to show appropriate messages to your users.
Example Usage
Error Types
1. Network Errors
- Emitted when there’s no internet connection
- The flow will not display
- You should show an appropriate “No internet connection” message
2. Placement Errors
- Emitted when there’s an issue with the placement ID or API key
- The flow will not display
- You should show an appropriate error message to the user
Error Event Structure
Network Error
Placement Error
Best Practices
-
User-Friendly Messages: Display error messages that are clear and actionable for users.
-
Error Recovery: Implement retry mechanisms for network errors.
-
Error Logging: Log errors for debugging and monitoring purposes.
-
Fallback Content: Provide fallback content or alternative flows when errors occur.
-
Error Prevention: Validate placement IDs and API keys before attempting to display flows.
Example Implementation
Error Codes
Network Errors
NETWORK_ERROR
: General network connectivity issuesTIMEOUT_ERROR
: Request timeoutOFFLINE_ERROR
: Device is offline
Placement Errors
INVALID_PLACEMENT_ID
: The provided placement ID is invalid or doesn’t existINVALID_API_KEY
: The API key is invalid or has been revokedPLACEMENT_NOT_FOUND
: The placement could not be foundPLACEMENT_DISABLED
: The placement has been disabledPLACEMENT_EXPIRED
: The placement has expired