node-oauth2-server icon indicating copy to clipboard operation
node-oauth2-server copied to clipboard

Replace InvalidArgumentError with ServerError

Open Uzlopak opened this issue 4 years ago • 3 comments

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

Uzlopak avatar Nov 15 '21 16:11 Uzlopak

Please also add, which parts of the code are affected and which tests need to be updated.

jankapunkt avatar Nov 16 '21 09:11 jankapunkt

Its actually scattered all over the place. It is everywhere used where an InternalServerError should be thrown because the implementor made an implementation error.

Uzlopak avatar Nov 16 '21 12:11 Uzlopak

We could also just patch the InvalidArgumentError to extend ServerError or change invalid_argument to server_error.

Uzlopak avatar Nov 16 '21 16:11 Uzlopak