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

Update error_handler.rb to handle nil error_code #755

Closed
wants to merge 1 commit into from

Conversation

ajcantu
Copy link

@ajcantu ajcantu commented Mar 30, 2015

We're occasionally seeing errors on this line:

NoMethodError: undefined method `sub' for nil:NilClass
File "/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.33/lib/aws-sdk-core/xml/error_handler.rb" line 55 in remove_prefix
File "/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.33/lib/aws-sdk-core/xml/error_handler.rb" line 50 in extract_error
File "/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.33/lib/aws-sdk-core/xml/error_handler.rb" line 21 in error
File "/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.33/lib/aws-sdk-core/xml/error_handler.rb" line 9 in block in call
File "/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.33/lib/seahorse/client/response.rb" line 43 in call

We're occasionally seeing errors on this line:

```
NoMethodError: undefined method `sub' for nil:NilClass
1
File "/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.33/lib/aws-sdk-core/xml/error_handler.rb" line 55 in remove_prefix
2
File "/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.33/lib/aws-sdk-core/xml/error_handler.rb" line 50 in extract_error
3
File "/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.33/lib/aws-sdk-core/xml/error_handler.rb" line 21 in error
4
File "/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.33/lib/aws-sdk-core/xml/error_handler.rb" line 9 in block in call
5
File "/opt/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/aws-sdk-core-2.0.33/lib/seahorse/client/response.rb" line 43 in call
```
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b48216c on ajcantu:patch-1 into * on aws:master*.

@trevorrowe
Copy link
Member

Have you tested this in your environment to see if it solves the problem? It looks like this will just move the error up to where it attempts to construct an error class from a nil error_code and raise there instead.

I'm very interested in the situation that can cause the response to have a body, but the SDK is unable to extract an error code. Would you be willing to run a patched version of the SDK that would log the http response body in one of these situations so we can see what is the root cause?

If you are, let me know, and I'll put together some code that would collect the needed information.

@ajcantu
Copy link
Author

ajcantu commented Mar 30, 2015

Ah, yes. It looks like it will just error later at:
https://github.com/aws/aws-sdk-ruby/blob/master/aws-sdk-core/lib/aws-sdk-core/errors.rb#L100

Ok, we'll try to get more information on why this is failing for us. It's only happened once in the last 4 days, so I'm not sure when we'll see it again, but we'll create a new pull request at that time.

Thanks for taking a look!

@ajcantu ajcantu closed this Mar 30, 2015
trevorrowe added a commit that referenced this pull request Mar 30, 2015
@trevorrowe
Copy link
Member

I went ahead an made a small change that will at a minimum prevent errors while attempting to parse the error code and messages and will fall-back on a friendly http status code based error. This should allow us to identify when this happens.

@ajcantu
Copy link
Author

ajcantu commented Mar 30, 2015

Sweet. Thanks, @trevorrowe!

@ajcantu ajcantu deleted the patch-1 branch March 30, 2015 22:42
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

Successfully merging this pull request may close these issues.

3 participants