Permalink
Browse files

Catch exception if JSON data cannot be parsed (#148)

  • Loading branch information...
whimboo committed Aug 13, 2012
1 parent 6f8c6a3 commit 3225a656a99b36c85116bccb7624b58956828125
Showing with 5 additions and 1 deletion.
  1. +5 −1 extension/lib/garbage-collector.js
@@ -92,7 +92,11 @@ const reporter = EventEmitter.compose({
let type = aTopic;
if (config.application.branch >= 14) {
- data = JSON.parse(aData);
+ try {
+ data = JSON.parse(aData);
+ } catch (e) {
+ Cu.reportError("Failure parsing JSON data: " + aData);
+ }
// Use milliseconds instead of microseconds for the timestamp
if ('timestamp' in data) {

0 comments on commit 3225a65

Please sign in to comment.