fac-13 / jeth

Find jobs near you :computer:
https://jeth.herokuapp.com/
1 stars 2 forks source link

JSON.parse is unsafe #35

Open eliasmalik opened 6 years ago

eliasmalik commented 6 years ago

JSON.parse will throw an exception if it's given a string that isn't valid JSON. This will be rare when dealing with an API like Github's, but it's best to be sure, especially if that error will prevent you from responding to the client, or take down your server entirely:

https://github.com/fac-13/jeth/blob/55aa475205ea69a649432a9c9cfd0b7e1854d083/src/handlers.js#L47

Or prevent your client-side code from updating the UI to let your user know what's happened:

https://github.com/fac-13/jeth/blob/55aa475205ea69a649432a9c9cfd0b7e1854d083/public/dom.js#L7

You'll need to use try/catch.