@platecms/delta-errors
v0.13.0
Published
Error classes and their data for the Delta platform.
Readme
errors
This package contains all error related implementations for both frontend and backend.
Features
This package contains errors and their context types that can be returned as API responses.
For example, the InvalidPrnError is not in here, because it should be returned as a BadRequestError if it is thrown.
Furthermore, these are all called "errors". The difference between errors and exceptions is specific to languages (or even frameworks):
- TypeScript/JavaScript uses errors exclusively. NestJS has exceptions to return as responses.
- Python uses exceptions exclusively.
Base classes and types
PlateError- Abstract base class for all Plate errors. Extends the standardErrorclass and provides context and error code functionality.ErrorCode- Enum containing all available error codes for identifying different types of errors.ResourceErrorContext- Interface defining the context structure for resource-related errors, including action type and resource type information.
Error classes
BadRequestError- Thrown when the request is malformed or contains invalid parameters.ForbiddenError- Thrown when the user is authenticated but does not have sufficient permissions to access a resource.InternalServerError- Thrown when an unexpected error occurs on the server side.InvalidCastError- Thrown when a CAST is invalid or malformed.InvalidPrnError- Thrown when a PRN is invalid or malformed.NotFoundError- Thrown when a requested resource cannot be found.NotImplementedError- Thrown when attempting to use functionality that has not been implemented.UnauthorizedError- Thrown when authentication is required but not provided or is invalid.UnprocessableContentError- Thrown when the request content is semantically incorrect.ValidationFailedError- Thrown when request validation fails.
