The idea is that we could have standard error types that are not tied to anything.
These errors can be used thought the app including external libraries.
Specific errors types can be handled easily to achieve different behavior.
HTTP middleware would be included to easily translate error types into relevent HTTP status codes.
Some error type ideas: InvalidParameter(s) = HTTP 400 Unauthorized = HTTP 401 Could not connect to backend = HTTP 500 Timeout = HTTP 504
I wouldn't want too many types to avoid overlapping.
You could also include custom middleware to just pass the error down in json format and let your client application maintain and use the same error types.
CommonErrors will also be Errors for backwards compatibility.
Express has error middleware like this:
I prefer this as it fits well in express and you don't have to overwrite anything to get new behavior. Just add another error middleware and you can do whatever you want.
Also, I have this repo:
https://github.com/addisonj/stdError
we could make it part of that?