This repository has been archived by the owner on Feb 16, 2025. It is now read-only.
Error #8
olavoasantos
announced in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@micra/error
Status
Type: Contract, Library
Start Date: 2022/03/14
Champion(s): @olavoasantos
Author(s): @olavoasantos
Epic: #7
Repository: https://github.com/micrajs/error
Issues: Project: error
Milestone: v0.1.0
Summary
This interface describes a standardized error interface. This allows different types of Micra applications (e.g. back-end API, front-end clients, mobile apps, ...) to consistently communicate and handle errors.
Motivation
Having a consistent way to communicate errors across applications makes the code more consistent and easier to handle. Moreover, this allows us to enforce well-established conventions in the community by following a standard (RFC 7807) rather than a completely custom design.
Description
Create custom errors
To create custom error while maintaining consistency, Micra should provide an extensible class that enforces the standard interface.
Example
Identifying and handling errors
While running Micra's application, we should have a clean and easy way to identify errors that adopt the standards. It is Micra's responsibility to provide an API for that.
Example
API
Micra's Error class
Error response payloads
Error responses should have a standard structure while still allowing extensibility. The usage of custom payload design can be tempting but comes with the cost of predictability and structure that is less tested. Based on this, Micra's error payload should follow patterns already accepted by the community enforcing, for example, the standard described by RFC 7807.
Comparison
Drawbacks
TODO...
Alternatives
TODO...
Implementations
TODO...
Q&A
How to identify a Micra.Error?
How to create custom errors while maintaining consistency?
Beta Was this translation helpful? Give feedback.
All reactions