title: How to specify HTTP error 422 instead of 400 in Hapi Joi
body: <p>Is there a way to get status 422 instead
  of 400 in <a href="https://github.com/hapijs/joi" rel="nofollow">https://github.com/hapijs/joi</a></p>
  
  <h2>UPDATE</h2>
  
  <p>after the reply of @Matt Harrison</p>
  
  <p>to apply the logic globally you can in
  your index.js</p>
  
  <pre><code>server.ext('onPreResponse', function (request, reply) {
      var req = request.response;
      if (req.isBoom &amp;&amp; (req.output.statusCode===400)) {
              return reply(Boom.badData(req.output.payload.message));
      }
          return reply.continue();
  });
  </code></pre>