{"action":"created","issue":{"url":"https://api.github.com/repos/go-pg/pg/issues/796","repository_url":"https://api.github.com/repos/go-pg/pg","labels_url":"https://api.github.com/repos/go-pg/pg/issues/796/labels{/name}","comments_url":"https://api.github.com/repos/go-pg/pg/issues/796/comments","events_url":"https://api.github.com/repos/go-pg/pg/issues/796/events","html_url":"https://github.com/go-pg/pg/issues/796","id":306197845,"number":796,"title":"Handling errors","user":{"login":"threeaccents","id":15348071,"avatar_url":"https://avatars3.githubusercontent.com/u/15348071?v=4","gravatar_id":"","url":"https://api.github.com/users/threeaccents","html_url":"https://github.com/threeaccents","followers_url":"https://api.github.com/users/threeaccents/followers","following_url":"https://api.github.com/users/threeaccents/following{/other_user}","gists_url":"https://api.github.com/users/threeaccents/gists{/gist_id}","starred_url":"https://api.github.com/users/threeaccents/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/threeaccents/subscriptions","organizations_url":"https://api.github.com/users/threeaccents/orgs","repos_url":"https://api.github.com/users/threeaccents/repos","events_url":"https://api.github.com/users/threeaccents/events{/privacy}","received_events_url":"https://api.github.com/users/threeaccents/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-17T23:03:40Z","updated_at":"2018-03-20T17:22:36Z","closed_at":null,"author_association":"NONE","body":"What would be the idiomatic way of handling errors. For example handling a `unique_constraint` error? Parsing the error string seems wrong do you have any recommendations?"},"comment":{"url":"https://api.github.com/repos/go-pg/pg/issues/comments/374684015","html_url":"https://github.com/go-pg/pg/issues/796#issuecomment-374684015","issue_url":"https://api.github.com/repos/go-pg/pg/issues/796","id":374684015,"user":{"login":"threeaccents","id":15348071,"avatar_url":"https://avatars3.githubusercontent.com/u/15348071?v=4","gravatar_id":"","url":"https://api.github.com/users/threeaccents","html_url":"https://github.com/threeaccents","followers_url":"https://api.github.com/users/threeaccents/followers","following_url":"https://api.github.com/users/threeaccents/following{/other_user}","gists_url":"https://api.github.com/users/threeaccents/gists{/gist_id}","starred_url":"https://api.github.com/users/threeaccents/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/threeaccents/subscriptions","organizations_url":"https://api.github.com/users/threeaccents/orgs","repos_url":"https://api.github.com/users/threeaccents/repos","events_url":"https://api.github.com/users/threeaccents/events{/privacy}","received_events_url":"https://api.github.com/users/threeaccents/received_events","type":"User","site_admin":false},"created_at":"2018-03-20T17:22:36Z","updated_at":"2018-03-20T17:22:36Z","author_association":"NONE","body":"I checked out the code. Not sure how to still go about it. The errors returned from pg.sql don't seem to adhere to the pg Error interface since they don't have the `Field` and `IntegrityViolation` methods. So how could I go about checking it? For some errors you have helper errors which makes it great. Like the example below. But I've I'm trying to check for constraint error I'm still stuck\r\n\r\n```go\r\nif err := s.DB.Model(l).Where(\"id = ?\", id).First(); err != nil {\r\n  if err == pg.ErrNoRows {\r\n    return nil, adioo.ErrNotFound\r\n  }\r\n  return nil, err\r\n}\r\n```"}}
{"actor":{"display_login":"threeaccents"}}