code: function validate(res, result) {
    if (!result) return true;
  
    var err = new Error('Validation failed');
    try {
      err.errors = result.errors();
    } catch (err) {
      err.errors = [result.validation];
    }
    err.expose = true;
    err.statusCode = 400;
    err.toJSON = function() {
      return {
        message: this.message,
        errors: this.errors,
      };
    };
  
    res.sf.reply(err);
  }
docs: Render validation errors.