Error Handling
PulsePI provides standardized error responses to help you debug and handle issues in your application.
Error Response Format
When an error occurs, PulsePI returns a response with the following structure:
json
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message."
}
}Common Error Codes
| Error Code | Description |
|---|---|
| MODULE_NOT_FOUND | The specified module does not exist |
| ACTION_NOT_FOUND | The specified action does not exist in the module |
| INVALID_PARAMS | The parameters provided are invalid or missing required fields |
| UNAUTHORIZED | The request lacks valid authentication credentials |
| FORBIDDEN | The authenticated user does not have permission to perform the action |
| INTERNAL_ERROR | An unexpected error occurred on the server |
Error Examples
Module Not Found
json
{
"error": {
"code": "MODULE_NOT_FOUND",
"message": "Module 'xyz' not found."
}
}Invalid Parameters
json
{
"error": {
"code": "INVALID_PARAMS",
"message": "Missing required parameter 'email'."
}
}Error Handling Best Practices
- Always check the response for an
errorproperty - Use the
codefor programmatic handling and themessagefor user display - Implement retry logic for transient errors (e.g., network issues)
- Log detailed error information for debugging