node-oauth2-provider
node-oauth2-provider copied to clipboard
Should stop catching all errors and instead callback with them.
The module's method of having wide try catch blocks and returning errors is not typical for node, and it leaves bugs undiscovered or harder to track down. It should either not catch the errors, or callback with them.
i only see two occurrences of try/catch, both of which are narrow in scope and intended to guard against invalid data being fed into JSON.parse
as used inside the serializer
module, which also throws when encountering a bad HMAC.
I would narrow the scope of the try catch block to just be wrapped around the serialization/deserialization part, and if it catches it, callback with the error rather than returning it.