Exceptions
Exceptions are unexpected faulty behaviours that occur during execution of the application. All errors and exceptions thrown by the Catalyst applications built upon Python environment are handled by the Exceptions module and the classes within it.
When an error or exception occurs in your application, the following properties of the exception are returned:
- code: Unique identifier of the error.
- errorMsg: General description about the error.
- errorDetails: Additional information about the error.
- originalException: In case of HTTP requests, returns HTTP status codes. Or else returns “None”.
The base class CatalystError is pre-defined in the Exceptions module of the Catalyst Python SDK package. It is inherited by multiple sub-classes which handles the exception and error scenarios that might occur during execution of the Catalyst components in your application.
An individual error class is configured for each Catalyst component as a part of the Python SDK and any unexpected events in the defined flow of the component executions, the respective errors will be thrown.
Example :
Consider you are executing a Catalyst Serverless function in your Catalyst application and the function returns an error code as the response. In this case, the respective error class pre-defined for the Functions component (CatalystFunctionError) will handle the scenario.
Likewise, if you are performing an incorrect database specific operation in the Catalyst DataStore, the exception will be caught and handled within the CatalystDataStoreError class.
Therefore, a unique error class is pre-defined for each Catalyst component as a part of the Exceptions module. The other common classes included in the module are CatalystAuthenticationError, Catalyst FileStore Error, Catalyst CacheError,Catalyst CronError,CatalystZiaError and more.
Additionally, the exceptions that are not caught by any component specific Python classes are handled in the CatalystAPIError class. This class handles the exceptions caught at the API level and defines the error codes for the failed API requests.
Listed below are some of the typical API error codes applicable to all Catalyst components:
Error Codes | Descriptions |
---|---|
INVALID ARGUEMENT ERROR | The arguments passed is not of a valid type for the specific format. |
INVALID CREDENTIAL ERROR | The credentials entered is not valid. |
Last Updated 2023-09-03 01:06:41 +0530 +0530
Yes
No
Send your feedback to us