{"action":"created","issue":{"url":"https://api.github.com/repos/boto/botocore/issues/1005","repository_url":"https://api.github.com/repos/boto/botocore","labels_url":"https://api.github.com/repos/boto/botocore/issues/1005/labels{/name}","comments_url":"https://api.github.com/repos/boto/botocore/issues/1005/comments","events_url":"https://api.github.com/repos/boto/botocore/issues/1005/events","html_url":"https://github.com/boto/botocore/pull/1005","id":171044512,"number":1005,"title":"ClientError subclass factory","user":{"login":"kislyuk","id":862013,"avatar_url":"https://avatars.githubusercontent.com/u/862013?v=3","gravatar_id":"","url":"https://api.github.com/users/kislyuk","html_url":"https://github.com/kislyuk","followers_url":"https://api.github.com/users/kislyuk/followers","following_url":"https://api.github.com/users/kislyuk/following{/other_user}","gists_url":"https://api.github.com/users/kislyuk/gists{/gist_id}","starred_url":"https://api.github.com/users/kislyuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kislyuk/subscriptions","organizations_url":"https://api.github.com/users/kislyuk/orgs","repos_url":"https://api.github.com/users/kislyuk/repos","events_url":"https://api.github.com/users/kislyuk/events{/privacy}","received_events_url":"https://api.github.com/users/kislyuk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-08-14T06:10:29Z","updated_at":"2016-09-15T22:46:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/boto/botocore/pulls/1005","html_url":"https://github.com/boto/botocore/pull/1005","diff_url":"https://github.com/boto/botocore/pull/1005.diff","patch_url":"https://github.com/boto/botocore/pull/1005.patch"},"body":"See also: https://github.com/boto/boto3/issues/167, https://github.com/boto/boto3/issues/361\r\n\r\nI'm using this PR to start a discussion about subclassing ClientError. Is there a plan for how to implement this? (I couldn't find any relevant notes in https://github.com/boto/boto3/issues/167.) The implementation here allows more useful error processing patterns in ClientError consumers, like:\r\n```\r\nimport boto3\r\nfrom botocore.errorfactory import NoSuchEntity\r\n\r\niam = boto3.resource(\"iam\")\r\n\r\ntry:\r\n    iam.Role(\"fakeRole\").load()\r\nexcept NoSuchEntity as e:\r\n    print(e)\r\n```\r\nThere are a few caveats, including the fact that the error factory has no ability to sanity check error names. I can add docs if I receive feedback that I'm on the right track."},"comment":{"url":"https://api.github.com/repos/boto/botocore/issues/comments/247476023","html_url":"https://github.com/boto/botocore/pull/1005#issuecomment-247476023","issue_url":"https://api.github.com/repos/boto/botocore/issues/1005","id":247476023,"user":{"login":"kislyuk","id":862013,"avatar_url":"https://avatars.githubusercontent.com/u/862013?v=3","gravatar_id":"","url":"https://api.github.com/users/kislyuk","html_url":"https://github.com/kislyuk","followers_url":"https://api.github.com/users/kislyuk/followers","following_url":"https://api.github.com/users/kislyuk/following{/other_user}","gists_url":"https://api.github.com/users/kislyuk/gists{/gist_id}","starred_url":"https://api.github.com/users/kislyuk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kislyuk/subscriptions","organizations_url":"https://api.github.com/users/kislyuk/orgs","repos_url":"https://api.github.com/users/kislyuk/repos","events_url":"https://api.github.com/users/kislyuk/events{/privacy}","received_events_url":"https://api.github.com/users/kislyuk/received_events","type":"User","site_admin":false},"created_at":"2016-09-15T22:46:08Z","updated_at":"2016-09-15T22:46:08Z","body":"Hi @kyleknap, I went ahead and added blind error extraction and a logger warning when that happens. Please have a look.\r\n\r\nI'm not entirely sure why the 2.6 tests failed; `dir(instance)` on 2.6 doesn't seem to call `__dir__()`, though the docs say it should. I disabled that check on 2.6.\r\n\r\nI took a look at the Ruby code; one nice thing they do is take out a mutex before creating the class, so a race among threads doesn't result in multiple copies of the class and `isinstance` failures.\r\n\r\nThe name mangling that the Ruby library does actually doesn't seem to make sense, so I would suggest going ahead with what we got here."}}
{"actor":{"display_login":"kislyuk"}}