-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Manta currently uses generic error messages which do not provide enough context for debugging or troubleshooting. To improve error handling, we need to implement custom errors that include both descriptive messages and unique error codes. This enhancement will enable better error tracking, allow for more informative logs, and assist users in understanding and resolving issues more quickly.
Objectives:
-
Develop a consistent error handling module that defines custom error types.
-
Each custom error should include:
- A clear, descriptive error message.
- A unique error code that can be referenced in documentation and support channels.
-
Ensure that the error handling mechanism is easily extendable for future error types.
Tasks:
Design Custom Error Structure:
-
Define a standard structure for custom errors (e.g., MantaError class) that includes:
- code: A unique error code (e.g., MANTA_001, OCHAMI_002, CSM_003, etc).
- message: A human-readable error message.
Implement Error Classes:
-
Create base error class(es) that other errors can extend.
-
Implement specific error classes for common scenarios such as:
- Invalid user input.
- Connection failures.
- Command execution errors.
-
Each class should have a predefined error code and message.
Integrate Custom Errors:
- Replace generic error messages in the Manta commands with the custom error classes.
- Ensure that error codes and messages are logged consistently and can be easily referenced in troubleshooting guides.
Documentation and Examples:
- Update the Manta documentation to include a section on error codes.
- Provide examples of how errors are thrown and handled within Manta.
- Create a mapping reference of error codes to their messages for user support.
Testing:
- Write unit tests to validate that errors are thrown correctly and include the appropriate code and message.
- Test the Manta behavior under different error conditions to ensure consistent error reporting.
Acceptance Criteria:
- A custom error handling module is implemented and integrated with Manta components (cli, http api, csm library, ochami library).
- Each custom error includes a unique error code and descriptive message.
- Documentation is updated with a clear error code mapping and usage examples.
- Unit tests cover the custom error logic and verify that errors propagate as expected.
- The Manta logs errors with both the code and message for easier debugging.