title: Identifying Mongoose schema validation errors as HTTP status codes
body: <p>I'm leveraging Keystone.js to provide a lightweight CMS and API. I'm checking for duplicate entries on a List as such:</p>
  
  <pre><code>Registration.schema.post('save', function(error, registration, next) {
    if (error &amp;&amp; error.name === 'MongoError' &amp;&amp; error.code === 11000) {
      error = Error(`409|${ registration['email'] } is already registered`);
    }
  
    next(error);
  });
  </code></pre>
  
  <p>I'm parsing the status code off the error message to return in my API endpoint.</p>
  
  <p>Is there a different way to provide a friendly error message for duplicates in Keystone admin and be able to return the correct status code for API calls?</p>