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 the xhr.responseText is a string here, JSON.parse will fail with Uncaught SyntaxError: Unexpected token a in JSON at position 0, which will break things.
https://github.com/fac-12/BudgetPlanner/blob/master/public/index.js#L22
If the
xhr.responseText
is a string here, JSON.parse will fail withUncaught SyntaxError: Unexpected token a in JSON at position 0
, which will break things.So its good to 'wrap'
JSON.parse
in atry/catch
block, see below for an example:https://stackoverflow.com/questions/29797946/handling-bad-json-parse-in-node-safely
PS. please share this with the whole cohort as its something thats valuable to know
The text was updated successfully, but these errors were encountered: