Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Handling of Boto3 Exceptions #7

Open
sean-smith opened this issue Oct 10, 2019 · 0 comments
Open

Better Handling of Boto3 Exceptions #7

sean-smith opened this issue Oct 10, 2019 · 0 comments

Comments

@sean-smith
Copy link
Contributor

Planning on fixing this asap, similar to how it's done in https://github.com/aws/aws-parallelcluster

Here's what a credential error looks like:

Traceback (most recent call last):
  File "/Users/seaam/.pyenv/versions/3.7.0/bin/awsbw", line 10, in <module>
    sys.exit(main())
  File "/Users/seaam/.pyenv/versions/3.7.0/lib/python3.7/site-packages/awsbw/awsbw.py", line 724, in main
    wrapper(start, args)
  File "/Users/seaam/.pyenv/versions/3.7.0/lib/python3.7/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/Users/seaam/.pyenv/versions/3.7.0/lib/python3.7/site-packages/awsbw/awsbw.py", line 710, in start
    args.queue,
  File "/Users/seaam/.pyenv/versions/3.7.0/lib/python3.7/site-packages/awsbw/awsbw.py", line 46, in __init__
    self.getJobs()
  File "/Users/seaam/.pyenv/versions/3.7.0/lib/python3.7/site-packages/awsbw/awsbw.py", line 326, in getJobs
    status=status
  File "/Users/seaam/.pyenv/versions/3.7.0/lib/python3.7/site-packages/awsbw/awsbw.py", line 245, in queueJobs
    jobStatus=status,
  File "/Users/seaam/.pyenv/versions/3.7.0/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/seaam/.pyenv/versions/3.7.0/lib/python3.7/site-packages/botocore/client.py", line 661, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ExpiredTokenException) when calling the ListJobs operation: The security token included in the request is expired

By handling ClientError, this could become:

$ awsbw -Q my-queue
An error occurred (ExpiredTokenException) when calling the ListJobs operation: The security token included in the request is expired
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant