index.js
function toJSON() {
  var obj =  { message: this.message, stack: this.stack }, key;

  for (key in this) {
    if (
         has.call(this, key)
      && 'function' !== typeof this[key]
    ) {
      obj[key] = this[key];
    }
  }

  return obj;
}
function toJSON() {
  var obj =  { message: this.message, stack: this.stack }, key;

  for (key in this) {
    if (
         has.call(this, key)
      && 'function' !== typeof this[key]
    ) {
      obj[key] = this[key];
    }
  }

  return obj;
}
function toJSON ( ) { var obj = { message : this . message , stack : this . stack } , key ; for ( key in this ) { if ( has . call ( this , key ) && 'function' !== typeof this [ key ] ) { obj [ key ] = this [ key ] ; } } return obj ; }
Return an object with all the information that should be in the JSON output.
It doesn't matter if we list keys that might not be in the err as the
JSON.stringify will remove properties who's values are set to `undefined`. So
we want to make sure that we include some common properties.

@returns {Object}
@api public
Return an object with all the information that should be in the JSON output . It doesn t matter if we list keys that might not be in the err as the JSON . stringify will remove properties who s values are set to undefined . So we want to make sure that we include some common properties .