lib/framework/middleware.js
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);
}
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);
}
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 ) ; }
Render validation errors.
Render validation errors .