{"action":"created","issue":{"url":"https://api.github.com/repos/dancannon/gorethink/issues/274","repository_url":"https://api.github.com/repos/dancannon/gorethink","labels_url":"https://api.github.com/repos/dancannon/gorethink/issues/274/labels{/name}","comments_url":"https://api.github.com/repos/dancannon/gorethink/issues/274/comments","events_url":"https://api.github.com/repos/dancannon/gorethink/issues/274/events","html_url":"https://github.com/dancannon/gorethink/issues/274","id":136257855,"number":274,"title":"Return specific error values for Insert(...).RunWrite(...)","user":{"login":"nstogner","id":10274189,"avatar_url":"https://avatars.githubusercontent.com/u/10274189?v=3","gravatar_id":"","url":"https://api.github.com/users/nstogner","html_url":"https://github.com/nstogner","followers_url":"https://api.github.com/users/nstogner/followers","following_url":"https://api.github.com/users/nstogner/following{/other_user}","gists_url":"https://api.github.com/users/nstogner/gists{/gist_id}","starred_url":"https://api.github.com/users/nstogner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nstogner/subscriptions","organizations_url":"https://api.github.com/users/nstogner/orgs","repos_url":"https://api.github.com/users/nstogner/repos","events_url":"https://api.github.com/users/nstogner/events{/privacy}","received_events_url":"https://api.github.com/users/nstogner/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dancannon/gorethink/labels/p:medium","name":"p:medium","color":"eb6420"},{"url":"https://api.github.com/repos/dancannon/gorethink/labels/s:investigating","name":"s:investigating","color":"F2F2F2"},{"url":"https://api.github.com/repos/dancannon/gorethink/labels/t:question","name":"t:question","color":"75D6FF"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-25T02:40:37Z","updated_at":"2016-03-15T21:14:18Z","closed_at":"2016-03-15T21:14:17Z","body":"As far as I can tell the only way of determining **why** a call to RunWrite has failed is by parsing the error string.\r\n\r\nFor instance if I want to return a 409-Conflict in my REST api when an insert fails due to an existing document, as opposed to a 500-Internal-Server-Error for other error cases, I need to parse the error string for the text: \"Duplicate primary key\". This seems brittle.\r\n\r\nCould a specific error value be returned (ErrConflict) for such cases?"},"comment":{"url":"https://api.github.com/repos/dancannon/gorethink/issues/comments/197022372","html_url":"https://github.com/dancannon/gorethink/issues/274#issuecomment-197022372","issue_url":"https://api.github.com/repos/dancannon/gorethink/issues/274","id":197022372,"user":{"login":"dancannon","id":414768,"avatar_url":"https://avatars.githubusercontent.com/u/414768?v=3","gravatar_id":"","url":"https://api.github.com/users/dancannon","html_url":"https://github.com/dancannon","followers_url":"https://api.github.com/users/dancannon/followers","following_url":"https://api.github.com/users/dancannon/following{/other_user}","gists_url":"https://api.github.com/users/dancannon/gists{/gist_id}","starred_url":"https://api.github.com/users/dancannon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dancannon/subscriptions","organizations_url":"https://api.github.com/users/dancannon/orgs","repos_url":"https://api.github.com/users/dancannon/repos","events_url":"https://api.github.com/users/dancannon/events{/privacy}","received_events_url":"https://api.github.com/users/dancannon/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T21:14:17Z","updated_at":"2016-03-15T21:14:17Z","body":"I have included the helper functions in 1.4.0, I know this isnt ideal but hopefully it helps a bit."}}