{"action":"opened","issue":{"url":"https://api.github.com/repos/hapijs/joi/issues/835","repository_url":"https://api.github.com/repos/hapijs/joi","labels_url":"https://api.github.com/repos/hapijs/joi/issues/835/labels{/name}","comments_url":"https://api.github.com/repos/hapijs/joi/issues/835/comments","events_url":"https://api.github.com/repos/hapijs/joi/issues/835/events","html_url":"https://github.com/hapijs/joi/issues/835","id":136735221,"number":835,"title":"Humanize error description","user":{"login":"guenogu","id":8956691,"avatar_url":"https://avatars.githubusercontent.com/u/8956691?v=3","gravatar_id":"","url":"https://api.github.com/users/guenogu","html_url":"https://github.com/guenogu","followers_url":"https://api.github.com/users/guenogu/followers","following_url":"https://api.github.com/users/guenogu/following{/other_user}","gists_url":"https://api.github.com/users/guenogu/gists{/gist_id}","starred_url":"https://api.github.com/users/guenogu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guenogu/subscriptions","organizations_url":"https://api.github.com/users/guenogu/orgs","repos_url":"https://api.github.com/users/guenogu/repos","events_url":"https://api.github.com/users/guenogu/events{/privacy}","received_events_url":"https://api.github.com/users/guenogu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-26T15:57:58Z","updated_at":"2016-02-26T15:57:58Z","closed_at":null,"body":"#### Context\r\n\r\n* *node version*: v4.2.4\r\n* *joi version*: ^7.2.2\r\n* *environment* (node, browser): node\r\n* *used with* (hapi, standalone, ...): hapi\r\n\r\n#### What are you trying to achieve or the steps to reproduce ?\r\n\r\nHow about offering the option of providing more user-friendly messages? \r\nFor instance, one could use a regular expression to validate a parameter and point the user to an ISO format specification in the error message.\r\n\r\n#### Which result you had ?\r\n\r\nWith the following schema definition:\r\n\r\n```javascript\r\nvar Joi = require('joi');\r\n\r\nvar schema = Joi.object({\r\n  a: Joi.any().required()\r\n}).label('foo');\r\n```\r\n\r\nthe result is:\r\n\r\n```js\r\n{\r\n    \"error\": \"bad_request\",\r\n    \"validation\": {\r\n        \"source\": \"payload\",\r\n        \"keys\": [\r\n            \"a\"\r\n        ]\r\n    },\r\n    \"status_code\": 400,\r\n    \"error_description\": \"child \\\"foo\\\" fails because [\\\"a\\\" is not allowed to be empty]\"\r\n}\r\n\r\n```\r\n\r\n#### What did you expect ?\r\n\r\nI would like to be able to **override** the error description to return a customized error description, as:\r\n\r\n```js\r\n{\r\n    \"error\": \"bad_request\",\r\n    \"validation\": {\r\n        \"source\": \"payload\",\r\n        \"keys\": [\r\n            \"a\"\r\n        ]\r\n    },\r\n    \"status_code\": 400,\r\n    \"error_description\": \"The \\\"a\\\" parameter is mandatory\"\r\n}\r\n\r\n```\r\n\r\nMaybe through:\r\n\r\n```javascript\r\nvar Joi = require('joi');\r\n\r\nvar schema = Joi.object({\r\n  a: Joi.any().required().customErrorMessage('The {{key}} parameter is mandatory')\r\n}).label('foo');\r\n```\r\n\r\nThoughts?\r\n"}}