Error.prototype.toJSON = function() {
  var json = {};

  Object.getOwnPropertyNames(this).forEach(function(key) {
    json[key] = this[key];
  }, this);
  return json;
};

@@ -37,135 +37,102 @@
 %7B%0A  
-var json = %7B%7D;%0A%0A  Object.getOwnPropertyNames(this).forEach(function(key) %7B%0A    json%5Bkey%5D = this%5Bkey%5D;%0A  %7D, this);%0A  return json
+return %7B%0A    type: this.constructor.name,%0A    message: this.message,%0A    stack: this.stack%0A  %7D
 ;%0A%7D;

Unify error toJSON