code: function(err, req, res, next) {
      err.message = err.message || 'Internal Server Error';
      err.code = err.code || res.code || 500;
      if (!_.isNumber(err.code)) {
        err.code = 500;
      }
  
      try {
        err.line = err.stack.split('\n')[1].match(/\(.+\)/)[0];
      } catch (e) {
        err.line = null;
      }
  
      var envelope = {
        meta: {
          code: err.code,
          error: {
            code: err.code,
            message: err.message,
            line: err.line
          }
        },
        data: err.message
      };
  
      // Set code and data
      res.code = err.code;
      res.data = envelope;
  
      return next();
    }
docs: Default middleware for handling error responses