Handle errors consistently when using JSON.parse or global eval. thanks @abramclark!