Proper error handling is crucial for creating robust and reliable connectors. Lumos provides both standard and custom error handling mechanisms to address various scenarios.
Standard Error Handling
Lumos offers a built-in exception handler that you can integrate into your connector:Custom Error Handling
For more specific error scenarios or to handle API-specific error codes, you can implement custom error handlers. Let’s examine a sample connector’s custom error handling as an example.Parse Error Response
Define Custom Exceptions
Implement Custom Error Handler
Register the Custom Error Handler
Best Practises
- API-Specific Errors: Map API-specific error codes to meaningful messages and appropriate Lumos error codes.
- Contextual Information: Include relevant context (e.g., capability, entitlement) in custom exceptions to aid in error diagnosis.
- Consistent Error Codes: Map custom errors to standard Lumos
ErrorCodevalues for consistency across connectors. - Fallback Handling: Always include a fallback case to handle unexpected errors gracefully.