title: Joi validation display custom error message
body: <p>Hi I am using  <code>&quot;@hapi/joi&quot;: &quot;^15.1.1&quot;</code>. Unfortunately, I can't update to the latest Joi version right now.</p>
  <p>This is my validation schema</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> const schema = {
      name: Joi.string()
        .allow("")
        .max(30),
      addLine1: Joi.string()
        .required()
        .label("Address Line 1"),
      locality: Joi.string()
        .required()
        .label("City"),
      region: Joi.string()
        .required()
        .label("State"),
      zipCode: Joi.number()
        .required()
        .label("Zip Code"),
      phoneNo: Joi.string()
        .required("Required")
        .regex(/^[0-9]{3}\-[0-9]{3}\-[0-9]{4}$/)
        
    };</code></pre>
  </div>
  </div>
  </p>
  <p>Then I validate and display the first error that occurred</p>
  <pre><code>const result = Joi.validate(this.state.addressDetails, this.schema, {
        abortEarly: true,
      });
   return const errors = result.error.details[0].message;
  </code></pre>
  <p>This works. The only problem is I want to display a custom error message instead of the default one.</p>
  <p>Default error message for address is <code>&quot;Address Line 1&quot; is not allowed to be empty&quot;</code>
  Instead of this, I want to display <code>&quot;Address is required!&quot;</code></p>
  <p>For the regex default one is</p>
  <pre><code>phoneNo with value &quot;555&quot; fails to match the required pattern: /^[0-9]{3}\-[0-9]{3}\-[0-9]{4}$/
  </code></pre>
  <p>Instead, I want to display <code>please enter a valid phone number</code></p>
  <p>How could I achieve this with version <code>15.1.1</code>.
  Newer versions <code>messages</code> thing won't help here.</p>