node-oauth2-server
node-oauth2-server copied to clipboard
Replace InvalidArgumentError with ServerError
InvalidArgumentError or invalid_argument is not a oauth2-error. It is used by oauth2-server to indicate errors like that specific internal implementation is wrong. E.g. Request is missing header. Also the HttpStatusCode of 500 clearly indicates that it is a ServerError and not something what the enduser can control.
https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1 https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2.1
Please also add, which parts of the code are affected and which tests need to be updated.
Its actually scattered all over the place. It is everywhere used where an InternalServerError should be thrown because the implementor made an implementation error.
We could also just patch the InvalidArgumentError to extend ServerError or change invalid_argument to server_error.