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

Provide a more friendly message on 401 #7

Open
pedrocunha opened this issue Nov 24, 2015 · 2 comments
Open

Provide a more friendly message on 401 #7

pedrocunha opened this issue Nov 24, 2015 · 2 comments

Comments

@pedrocunha
Copy link

The tool should not blow up on invalid credentials:

$ elba list
/Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/excon-0.44.4/lib/excon/middlewares/expects.rb:6:in `response_call': InvalidClientTokenId => The security token included in the request is invalid. (Fog::AWS::ELB::Error)
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/excon-0.44.4/lib/excon/middlewares/response_parser.rb:8:in `response_call'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/excon-0.44.4/lib/excon/connection.rb:372:in `response'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/excon-0.44.4/lib/excon/connection.rb:236:in `request'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fog-xml-0.1.1/lib/fog/xml/sax_parser_connection.rb:37:in `request'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fog-xml-0.1.1/lib/fog/xml/connection.rb:7:in `request'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fog-aws-0.1.1/lib/fog/aws/elb.rb:198:in `_request'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fog-aws-0.1.1/lib/fog/aws/elb.rb:193:in `request'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fog-aws-0.1.1/lib/fog/aws/requests/elb/describe_load_balancers.rb:61:in `describe_load_balancers'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fog-aws-0.1.1/lib/fog/aws/models/elb/load_balancers.rb:18:in `all'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fog-core-1.29.0/lib/fog/core/collection.rb:113:in `lazy_load'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/fog-core-1.29.0/lib/fog/core/collection.rb:17:in `size'
    from /Users/pedrocunha/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/elba-0.0.5/lib/elba/cli.rb:66:in `list'

Maybe worth to catch this exception and provide a better message ?

@mrship
Copy link
Contributor

mrship commented Nov 24, 2015

You get a slightly more friendly error with the latest version with upgraded gems that points to the root cause.

➜  bin/elba list       
Digest::Digest is deprecated; use Digest
/Users/mrship/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/excon-0.23.0/lib/excon/middlewares/expects.rb:6:in `response_call': Expected(200) <=> Actual(403 Forbidden) (Excon::Errors::Forbidden)
  response => #<Excon::Response:0x007f8e232c9620 @data={:body=>"<ErrorResponse xmlns=\"http://elasticloadbalancing.amazonaws.com/doc/2012-06-01/\">\n  <Error>\n    <Type>Sender</Type>\n    <Code>InvalidClientTokenId</Code>\n    <Message>The security token included in the request is invalid</Message>\n

Given all other errors also raise - missing credentials, other Fog errors etc. - I think an overhaul of the errors would be needed.

@pedrocunha
Copy link
Author

I still think we could try to progressively rescue some of the errors and provide better error messages

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

2 participants