{"action":"created","issue":{"url":"https://api.github.com/repos/robconery/massive-js/issues/214","repository_url":"https://api.github.com/repos/robconery/massive-js","labels_url":"https://api.github.com/repos/robconery/massive-js/issues/214/labels{/name}","comments_url":"https://api.github.com/repos/robconery/massive-js/issues/214/comments","events_url":"https://api.github.com/repos/robconery/massive-js/issues/214/events","html_url":"https://github.com/robconery/massive-js/issues/214","id":137080228,"number":214,"title":"How to get postgresql error code","user":{"login":"alexishevia","id":261408,"avatar_url":"https://avatars.githubusercontent.com/u/261408?v=3","gravatar_id":"","url":"https://api.github.com/users/alexishevia","html_url":"https://github.com/alexishevia","followers_url":"https://api.github.com/users/alexishevia/followers","following_url":"https://api.github.com/users/alexishevia/following{/other_user}","gists_url":"https://api.github.com/users/alexishevia/gists{/gist_id}","starred_url":"https://api.github.com/users/alexishevia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexishevia/subscriptions","organizations_url":"https://api.github.com/users/alexishevia/orgs","repos_url":"https://api.github.com/users/alexishevia/repos","events_url":"https://api.github.com/users/alexishevia/events{/privacy}","received_events_url":"https://api.github.com/users/alexishevia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-28T18:30:14Z","updated_at":"2016-03-01T06:52:47Z","closed_at":null,"body":"On previous massive-js versions, the error object would bring info like:\r\n```\r\n{\r\n    \"code\": \"23505\",\r\n    \"constraint\": \"events_pkey\",\r\n    \"detail\": \"Key (id)=(test123) already exists.\",\r\n    \"file\": \"nbtinsert.c\",\r\n    \"length\": 222,\r\n    \"line\": \"406\",\r\n    \"name\": \"error\",\r\n    \"routine\": \"_bt_check_unique\",\r\n    \"schema\": \"public\",\r\n    \"severity\": \"ERROR\",\r\n    \"table\": \"events\",\r\n    \"where\": \"SQL function \\\"createEvent\\\" statement 1\"\r\n}\r\n```\r\nSo it was pretty easy for me to grab the error code and check against [PostgreSQL Error Codes](http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html) to determine how I wanted to handle it.\r\n\r\nI updated to massive-js 2.1.0, and now the error object is limited to returning a single message:\r\n```\r\n{ \"message\": \"duplicate key value violates unique constraint \\\"events_pkey\\\"\" }\r\n```\r\n\r\nIs there any way I can get access to the error code as before?"},"comment":{"url":"https://api.github.com/repos/robconery/massive-js/issues/comments/190580072","html_url":"https://github.com/robconery/massive-js/issues/214#issuecomment-190580072","issue_url":"https://api.github.com/repos/robconery/massive-js/issues/214","id":190580072,"user":{"login":"diegoaguilar","id":2483678,"avatar_url":"https://avatars.githubusercontent.com/u/2483678?v=3","gravatar_id":"","url":"https://api.github.com/users/diegoaguilar","html_url":"https://github.com/diegoaguilar","followers_url":"https://api.github.com/users/diegoaguilar/followers","following_url":"https://api.github.com/users/diegoaguilar/following{/other_user}","gists_url":"https://api.github.com/users/diegoaguilar/gists{/gist_id}","starred_url":"https://api.github.com/users/diegoaguilar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/diegoaguilar/subscriptions","organizations_url":"https://api.github.com/users/diegoaguilar/orgs","repos_url":"https://api.github.com/users/diegoaguilar/repos","events_url":"https://api.github.com/users/diegoaguilar/events{/privacy}","received_events_url":"https://api.github.com/users/diegoaguilar/received_events","type":"User","site_admin":false},"created_at":"2016-03-01T06:52:47Z","updated_at":"2016-03-01T06:52:47Z","body":"@alexishevia did u achieve it?"}}