code: function errorJSON (err) {
    var res = {}
    Object.getOwnPropertyNames(err).forEach(function (key) {
      res[key] = err[key]
    }, err)
    return res
  }
docs: Transform `error` into a JSON object.
  
  @api private
  @param {Error} err
  @return {Object}