Fireorm can throw different types of errors, including Firestore errors, validation errors, and other generic errors. Currently, error declarations are scattered throughout the codebase, leading to duplicated and inconsistent error handling. To improve maintainability and readability, error handling should be centralized.
Steps to Reproduce
Trigger different types of errors in Fireorm.
Observe the scattered and duplicated error declarations.
Expected Behavior
Centralized error handling with consistent error messages and types, reducing code duplication and improving maintainability.
Actual Behavior
Error declarations are scattered throughout the codebase, leading to duplicated and inconsistent error handling.
Acceptance Criteria
Refactor new Error() instances in the codebase by creating centralized error definitions in src/Errors.
Remove duplicated error declarations.
Ensure consistent error handling throughout the codebase.
Additional Context
October 17, 2020: Initial proposal to refactor error handling in Fireorm.
Proposed API Changes
Centralize Error Definitions:
Create a centralized location for error definitions in src/Errors.
Description
Fireorm can throw different types of errors, including Firestore errors, validation errors, and other generic errors. Currently, error declarations are scattered throughout the codebase, leading to duplicated and inconsistent error handling. To improve maintainability and readability, error handling should be centralized.
Steps to Reproduce
Expected Behavior
Centralized error handling with consistent error messages and types, reducing code duplication and improving maintainability.
Actual Behavior
Error declarations are scattered throughout the codebase, leading to duplicated and inconsistent error handling.
Acceptance Criteria
new Error()
instances in the codebase by creating centralized error definitions insrc/Errors
.Additional Context
Proposed API Changes
Centralize Error Definitions:
src/Errors
.Refactor Error Handling in Codebase:
new Error()
with the appropriate custom error classes.Remove Duplicated Error Declarations:
Example Implementation
Original Issue