code: function serializeError(err) {
    var o = {};
  
    Object.getOwnPropertyNames(err).forEach(function (k) {
      o[k] = err[k];
    });
  
    return _.omit(o, ['stack', 'type', 'arguments']);
  }
docs: Serialize a JavaScript error