Skip to content

Commit

Permalink
Deal with AccessDeniedException #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Bastida committed May 19, 2015
1 parent 25718e6 commit 38424d5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions awslogs/bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def main(argv=None):
except exceptions.ConnectionError, exc:
sys.stderr.write(colored("awslogs can't connecto to AWS.\n", "red"))
return exc.code
except exceptions.AccessDeniedException, exc:
sys.stderr.write(colored(exc.message, "red"))
return exc.code
except Exception:
import platform
import traceback
Expand Down
3 changes: 3 additions & 0 deletions awslogs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def aws_connection_wrap(*args, **kwargs):
if exc.error_code == u'ThrottlingException':
gevent.sleep(1)
continue
elif exc.error_code == u'AccessDeniedException':
hint = exc.body.get('Message', 'AccessDeniedException')
raise exceptions.AccessDeniedException('{0}\n'.format(hint))
raise
except Exception, exc:
raise
Expand Down
3 changes: 3 additions & 0 deletions awslogs/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ class ConnectionError(BaseAWSLogsException):

class UnknownDateError(BaseAWSLogsException):
code = 3

class AccessDeniedException(BaseAWSLogsException):
code = 4

0 comments on commit 38424d5

Please sign in to comment.