{"action":"created","issue":{"url":"https://api.github.com/repos/pkg/errors/issues/59","repository_url":"https://api.github.com/repos/pkg/errors","labels_url":"https://api.github.com/repos/pkg/errors/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/pkg/errors/issues/59/comments","events_url":"https://api.github.com/repos/pkg/errors/issues/59/events","html_url":"https://github.com/pkg/errors/issues/59","id":162035253,"number":59,"title":"Proposal: verbose errors","user":{"login":"RaduBerinde","id":16544120,"avatar_url":"https://avatars.githubusercontent.com/u/16544120?v=3","gravatar_id":"","url":"https://api.github.com/users/RaduBerinde","html_url":"https://github.com/RaduBerinde","followers_url":"https://api.github.com/users/RaduBerinde/followers","following_url":"https://api.github.com/users/RaduBerinde/following{/other_user}","gists_url":"https://api.github.com/users/RaduBerinde/gists{/gist_id}","starred_url":"https://api.github.com/users/RaduBerinde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RaduBerinde/subscriptions","organizations_url":"https://api.github.com/users/RaduBerinde/orgs","repos_url":"https://api.github.com/users/RaduBerinde/repos","events_url":"https://api.github.com/users/RaduBerinde/events{/privacy}","received_events_url":"https://api.github.com/users/RaduBerinde/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pkg/errors/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-06-23T22:12:15Z","updated_at":"2016-06-24T00:08:14Z","closed_at":null,"body":"In many cases when we're generating an error we know that the particular error, if it happens, is indicative of a bug. In those cases, it's very useful if the error message contains more information (like file:line). \r\n\r\nErrors might be handled at a different layer (e.g. sent out to a client using `%s`) where the original context of the error is lost.\r\n\r\nThe proposal is to add a version of `Errorf` which results in a \"verbose\" error which automatically includes the file:line where it was generated as part of the error message."},"comment":{"url":"https://api.github.com/repos/pkg/errors/issues/comments/228221911","html_url":"https://github.com/pkg/errors/issues/59#issuecomment-228221911","issue_url":"https://api.github.com/repos/pkg/errors/issues/59","id":228221911,"user":{"login":"RaduBerinde","id":16544120,"avatar_url":"https://avatars.githubusercontent.com/u/16544120?v=3","gravatar_id":"","url":"https://api.github.com/users/RaduBerinde","html_url":"https://github.com/RaduBerinde","followers_url":"https://api.github.com/users/RaduBerinde/followers","following_url":"https://api.github.com/users/RaduBerinde/following{/other_user}","gists_url":"https://api.github.com/users/RaduBerinde/gists{/gist_id}","starred_url":"https://api.github.com/users/RaduBerinde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RaduBerinde/subscriptions","organizations_url":"https://api.github.com/users/RaduBerinde/orgs","repos_url":"https://api.github.com/users/RaduBerinde/repos","events_url":"https://api.github.com/users/RaduBerinde/events{/privacy}","received_events_url":"https://api.github.com/users/RaduBerinde/received_events","type":"User","site_admin":false},"created_at":"2016-06-24T00:08:14Z","updated_at":"2016-06-24T00:08:14Z","body":"Here is a high level illustration of why this is useful. Say our program logic is something like this:\r\n\r\n```\r\n1:  for {\r\n2:    receive user request\r\n3:    call into module X to satisfy request\r\n4:      -> module X calls into module Y\r\n5:         ..\r\n6:            -> somewhere deep in the bowels of a submodule, an error is generated and bubbles up\r\n7:\r\n8:    send error to user\r\n9:  }\r\n```\r\n\r\nSome errors are expected to be seen by a user (e.g. \"no more space\"); other errors are caused by some internal inconsistency and indicate a bug. We want the latter to print more verbosely. We know the difference *when we generate the error* (line 6) but the \"send error to client\" code in line 8 does not know - all it has is the `error`. So the \"verbosity\" needs to be stored inside the error."}}
{"actor":{"display_login":"RaduBerinde"}}