Skip to content

Commit

Permalink
fix(client): catch JSON parse errors
Browse files Browse the repository at this point in the history
  • Loading branch information
simme committed Apr 25, 2015
1 parent 1e167d3 commit 5bb84ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion assets/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,12 @@
fn(null, JSON.parse(this.responseText), this);
}
else if (this.readyState === 4 && this.status !== 200) {
fn(JSON.parse(this.responseText), null, this);
try {
fn(JSON.parse(this.responseText), null, this);
} catch (err) {
// @TODO: Handle this error.
console.log(err);
}
}
};
req.open(method, host);
Expand Down

0 comments on commit 5bb84ce

Please sign in to comment.