{"action":"created","issue":{"url":"https://api.github.com/repos/boto/botocore/issues/493","labels_url":"https://api.github.com/repos/boto/botocore/issues/493/labels{/name}","comments_url":"https://api.github.com/repos/boto/botocore/issues/493/comments","events_url":"https://api.github.com/repos/boto/botocore/issues/493/events","html_url":"https://github.com/boto/botocore/pull/493","id":62223000,"number":493,"title":"Raise more specific exception when no region is configured","user":{"login":"jamesls","id":368057,"avatar_url":"https://avatars.githubusercontent.com/u/368057?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesls","html_url":"https://github.com/jamesls","followers_url":"https://api.github.com/users/jamesls/followers","following_url":"https://api.github.com/users/jamesls/following{/other_user}","gists_url":"https://api.github.com/users/jamesls/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesls/subscriptions","organizations_url":"https://api.github.com/users/jamesls/orgs","repos_url":"https://api.github.com/users/jamesls/repos","events_url":"https://api.github.com/users/jamesls/events{/privacy}","received_events_url":"https://api.github.com/users/jamesls/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-16T22:14:53Z","updated_at":"2015-03-16T22:30:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/boto/botocore/pulls/493","html_url":"https://github.com/boto/botocore/pull/493","diff_url":"https://github.com/boto/botocore/pull/493.diff","patch_url":"https://github.com/boto/botocore/pull/493.patch"},"body":"Currently, if no region is configured, you get a vague error message that isn't very clear:\r\n\r\n```\r\nIn [1]: s.create_client('ec2')\r\nUnknownEndpointError: Unable to construct an endpoint for ec2 in region None\r\n```\r\n\r\nNow, if the endpoint heuristics fail and there's no region name you'll get a `NoRegionError`:\r\n\r\n```\r\nIn [1]: s.create_client('ec2')\r\nNoRegionError: You must specify a region.\r\n```\r\n\r\nThis also translates to better error messages in the CLI:\r\n\r\nBEFORE:\r\n\r\n```\r\n$ aws ec2 describe-instances\r\n\r\nUnable to construct an endpoint for ec2 in region None\r\n```\r\n\r\nAFTER:\r\n\r\n```\r\n$ aws ec2 describe-instances\r\nYou must specify a region. You can also configure your region by running \"aws configure\".\r\n```\r\n\r\nOne of the other changes I made was to remove the `env_var` value from the NoRegionError.  From the commit message:\r\n\r\n\r\n> First, we were using this inconsistently.  In the botocore\r\nlayer, this is actually BOTO_DEFAULT_REGION, and in some\r\nplaces we were using AWS_DEFAULT_REGION.  Secondly, this value\r\nis technically pluggable via session_vars in the Session\r\n__init__.  And finally, you can actually set this value in the\r\nconfig file so it's weird to only mention env vars.\r\n\r\nI don't think there's any loss in helpfulness by removing this variable from the exception message.\r\n\r\n\r\ncc @kyleknap @danielgtaylor"},"comment":{"url":"https://api.github.com/repos/boto/botocore/issues/comments/81967253","html_url":"https://github.com/boto/botocore/pull/493#issuecomment-81967253","issue_url":"https://api.github.com/repos/boto/botocore/issues/493","id":81967253,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2015-03-16T22:30:17Z","updated_at":"2015-03-16T22:30:17Z","body":"\n[![Coverage Status](https://coveralls.io/builds/2126909/badge)](https://coveralls.io/builds/2126909)\n\nCoverage decreased (-0.02%) to 94.56% when pulling **fe850d2efe9bd95fad7a3a6f00f7701405111e5e on jamesls:bad-region-configured** into **73b59f1a35588dade0662ae0d7f000e94eb3a2e7 on boto:develop**.\n"}}