You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you read the documentation for the verify method of the jwt package, you will see that if the secret is wrong, the method will throw an error. That means you must protect your code with a catch block unless you want your server to crash.
JSON.parse will also throw if its input is not a valid JSON string. You should get in the habit of protecting calls to JSON.parse with a catch block too.
The text was updated successfully, but these errors were encountered:
eliasmalik
changed the title
error handling for jwt.verify
error handling for jwt.verify and JSON.parse
Aug 24, 2017
jwt.verify
If you read the documentation for the
verify
method of thejwt
package, you will see that if the secret is wrong, the method will throw an error. That means you must protect your code with acatch
block unless you want your server to crash.Nerd-s-flashCards/src/handlers.js
Line 140 in 8febfae
JSON.parse
JSON.parse
will also throw if its input is not a valid JSON string. You should get in the habit of protecting calls toJSON.parse
with acatch
block too.The text was updated successfully, but these errors were encountered: