{"action":"created","issue":{"url":"https://api.github.com/repos/mailjet/mailjet-gem/issues/37","labels_url":"https://api.github.com/repos/mailjet/mailjet-gem/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/mailjet/mailjet-gem/issues/37/comments","events_url":"https://api.github.com/repos/mailjet/mailjet-gem/issues/37/events","html_url":"https://github.com/mailjet/mailjet-gem/issues/37","id":75303621,"number":37,"title":"allow accessing error data","user":{"login":"AlexandreBernard","id":37109,"avatar_url":"https://avatars.githubusercontent.com/u/37109?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexandreBernard","html_url":"https://github.com/AlexandreBernard","followers_url":"https://api.github.com/users/AlexandreBernard/followers","following_url":"https://api.github.com/users/AlexandreBernard/following{/other_user}","gists_url":"https://api.github.com/users/AlexandreBernard/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexandreBernard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexandreBernard/subscriptions","organizations_url":"https://api.github.com/users/AlexandreBernard/orgs","repos_url":"https://api.github.com/users/AlexandreBernard/repos","events_url":"https://api.github.com/users/AlexandreBernard/events{/privacy}","received_events_url":"https://api.github.com/users/AlexandreBernard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-05-11T17:48:23Z","updated_at":"2015-09-07T12:12:34Z","closed_at":null,"body":"I can see on the exception code that the api returns some more detailed json but - stop me if i'm wrong - we can't programmatically access it rescuing mallet exceptions as it's mixed with some other strings.\r\n\r\nwould it be possible to make it accessible?\r\n\r\nsorry if it's not ruby specific but also it would be great to have standard codes for each errors on the api.\r\n\r\nfor example this error is not specific enough:\r\n\r\n\"{ \\\"ErrorInfo\\\" : \\\"\\\", \\\"ErrorMessage\\\" : \\\"MJ18 A Contact resource with value \\\\\\\"contact@xxxx.com\\\\\\\" for Email already exists.\\\", \\\"StatusCode\\\" : 400 }\"\r\n\r\nfor now i will test for \"Email already exists\" presence but it's a really dirty hack. Accessing this json within exception rescuing and having something like ErrorCode: 'ExistingEmail' would be the perfect thing\r\n\r\nAlexandre"},"comment":{"url":"https://api.github.com/repos/mailjet/mailjet-gem/issues/comments/138281325","html_url":"https://github.com/mailjet/mailjet-gem/issues/37#issuecomment-138281325","issue_url":"https://api.github.com/repos/mailjet/mailjet-gem/issues/37","id":138281325,"user":{"login":"GuillaumeBadi","id":6558790,"avatar_url":"https://avatars.githubusercontent.com/u/6558790?v=3","gravatar_id":"","url":"https://api.github.com/users/GuillaumeBadi","html_url":"https://github.com/GuillaumeBadi","followers_url":"https://api.github.com/users/GuillaumeBadi/followers","following_url":"https://api.github.com/users/GuillaumeBadi/following{/other_user}","gists_url":"https://api.github.com/users/GuillaumeBadi/gists{/gist_id}","starred_url":"https://api.github.com/users/GuillaumeBadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuillaumeBadi/subscriptions","organizations_url":"https://api.github.com/users/GuillaumeBadi/orgs","repos_url":"https://api.github.com/users/GuillaumeBadi/repos","events_url":"https://api.github.com/users/GuillaumeBadi/events{/privacy}","received_events_url":"https://api.github.com/users/GuillaumeBadi/received_events","type":"User","site_admin":false},"created_at":"2015-09-07T12:12:34Z","updated_at":"2015-09-07T12:12:34Z","body":"Hey @AlexandreBernard, If you have any question, i would be happy to help ! Otherwise, could you close this issue ?\r\n\r\nRegards, \r\nGuillaume"}}