title: Custom validation error using Sequelize.js
body: <p>Is possible to customize the error from the </p>
  
  <blockquote>
    <p>Sequelize.ValidationError</p>
  </blockquote>
  
  <p>Model:</p>
  
  <pre><code>  var PaymentType = sequelize.define('payment_type' , {
        id: {
        type: DataTypes.INTEGER(11),
        allowNull: false,
        primaryKey: true,
        autoIncrement: true,
        field: 'id'
      },
      code: {
        type: DataTypes.STRING,
        allowNull: false,
        validate:{
          notEmpty: true
        },
        field: 'code'
      },
      name: {
        type: DataTypes.STRING,
        allowNull: false,
        validate:{
          notEmpty: true
        },
        field: 'name'
      }
    }, {
      timestamps: true,
      paranoid: false,
      underscored: true,
      freezeTableName: true,
      tableName: 'payment_types'
    });
  </code></pre>
  
  <p>My controller:</p>
  
  <pre><code>  update(req, res) {
        paymentType
          .update(req.body, {
            where: {
              id: req.params.id
            }
          })
          .then( updatedRecords =&gt; {
            res.status(200).json(updatedRecords);
          })
          .catch(Sequelize.ValidationError, error =&gt; {
            res.status(400).json(error);
          })
          .catch( error =&gt; {
            res.status(500).json(error);
          });
  
    },
  </code></pre>
  
  <p>The errors I get, are this way:</p>
  
  <pre><code>{
    "name": "SequelizeValidationError",
    "message": "Validation error: Validation notEmpty failed",
    "errors": [
      {
        "message": "Validation notEmpty failed",
        "type": "Validation error",
        "path": "name",
        "value": {},
        "__raw": {}
      }
    ]
  }
  </code></pre>
  
  <p>I want to pass the errors like this(only path and message):</p>
  
  <pre><code>{
  "name":"The field cannot be empty",
  "other_field":"custom error message"
  }
  </code></pre>
  
  <p>I don't know if I can specify a custom message in the model or I have to create a function to build the errors messages.</p>
  
  <p>If I have to build a function, how can I extract the path and customize the message?</p>
  
  <p>Thanks in Advance.</p>