{"action":"created","issue":{"url":"https://api.github.com/repos/lykmapipo/sails-hook-validation/issues/8","labels_url":"https://api.github.com/repos/lykmapipo/sails-hook-validation/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/lykmapipo/sails-hook-validation/issues/8/comments","events_url":"https://api.github.com/repos/lykmapipo/sails-hook-validation/issues/8/events","html_url":"https://github.com/lykmapipo/sails-hook-validation/issues/8","id":66273169,"number":8,"title":"Not working as expected.","user":{"login":"hussainb","id":4962633,"avatar_url":"https://avatars.githubusercontent.com/u/4962633?v=3","gravatar_id":"","url":"https://api.github.com/users/hussainb","html_url":"https://github.com/hussainb","followers_url":"https://api.github.com/users/hussainb/followers","following_url":"https://api.github.com/users/hussainb/following{/other_user}","gists_url":"https://api.github.com/users/hussainb/gists{/gist_id}","starred_url":"https://api.github.com/users/hussainb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hussainb/subscriptions","organizations_url":"https://api.github.com/users/hussainb/orgs","repos_url":"https://api.github.com/users/hussainb/repos","events_url":"https://api.github.com/users/hussainb/events{/privacy}","received_events_url":"https://api.github.com/users/hussainb/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-04T04:23:18Z","updated_at":"2015-04-04T07:52:55Z","closed_at":"2015-04-04T07:52:55Z","body":"Hello,\r\n\r\nThis looked like a good solution for my custom validation message needs, but unfortunately this is not working.\r\n\r\nI am using sails 11 \r\n\r\nBelow is my model:\r\n\r\n\tmodule.exports = {\r\n\r\n\t\tattributes: {\r\n\t\t\tname: {\r\n\t\t\t\ttype: \"string\",\r\n\t\t\t\tunique: true\r\n\t\t\t},\r\n\t\t\temail: {\r\n\t\t\t\ttype: \"email\",\r\n\t\t\t\tunique: true\r\n\t\t\t},\r\n\t\t\tpassword: {\r\n\t\t\t\ttype: \"string\"\r\n\t\t\t}\r\n\t\t},\r\n\t\tvalidationMessages: { //hand for i18n & l10n\r\n\t\t\tname: {\r\n\t\t\t\tunique: 'name is already taken'\r\n\t\t\t},\r\n\t\t\temail: {\r\n\t\t\t\trequired: 'Email is required',\r\n\t\t\t\temail: 'Provide valid email address',\r\n\t\t\t\tunique: 'Email address is already taken'\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n\r\n\r\nDont know if this interests you or not, but this is the sails generated error object which I got form `console.log(error)` at `node_modules/sails-hook-validation/lib/create.js`  line no: 50, before the `if(error.ValidationError)`.\r\n\r\n\t{\r\n\t\t\"error\" : \"E_VALIDATION\",\r\n\t\t\"status\" : 400,\r\n\t\t\"summary\" : \"2 attributes are invalid\",\r\n\t\t\"invalidAttributes\" : {\r\n\t\t\t\"name\" : [{\r\n\t\t\t\t\t\"value\" : \"hb\",\r\n\t\t\t\t\t\"rule\" : \"unique\",\r\n\t\t\t\t\t\"message\" : \"A record with that `name` already exists (`hb`).\"\r\n\t\t\t\t}\r\n\t\t\t],\r\n\t\t\t\"email\" : [{\r\n\t\t\t\t\t\"value\" : \"me@gmail.com\",\r\n\t\t\t\t\t\"rule\" : \"unique\",\r\n\t\t\t\t\t\"message\" : \"A record with that `email` already exists (`me@gmail.com`).\"\r\n\t\t\t\t}\r\n\t\t\t]\r\n\t\t}\r\n\t}\r\n\r\n\r\nSince the above `error` object do not have the `ValidationError` property, It will not be going into the if statement."},"comment":{"url":"https://api.github.com/repos/lykmapipo/sails-hook-validation/issues/comments/89519972","html_url":"https://github.com/lykmapipo/sails-hook-validation/issues/8#issuecomment-89519972","issue_url":"https://api.github.com/repos/lykmapipo/sails-hook-validation/issues/8","id":89519972,"user":{"login":"lykmapipo","id":1610857,"avatar_url":"https://avatars.githubusercontent.com/u/1610857?v=3","gravatar_id":"","url":"https://api.github.com/users/lykmapipo","html_url":"https://github.com/lykmapipo","followers_url":"https://api.github.com/users/lykmapipo/followers","following_url":"https://api.github.com/users/lykmapipo/following{/other_user}","gists_url":"https://api.github.com/users/lykmapipo/gists{/gist_id}","starred_url":"https://api.github.com/users/lykmapipo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lykmapipo/subscriptions","organizations_url":"https://api.github.com/users/lykmapipo/orgs","repos_url":"https://api.github.com/users/lykmapipo/repos","events_url":"https://api.github.com/users/lykmapipo/events{/privacy}","received_events_url":"https://api.github.com/users/lykmapipo/received_events","type":"User","site_admin":false},"created_at":"2015-04-04T07:52:55Z","updated_at":"2015-04-04T07:52:55Z","body":"@hussainb Ok."}}