Cannot set `:raise_errors => false` in a request when client has it set to `true` #80

Closed
rewritten opened this Issue Nov 24, 2011 · 2 comments

Projects

None yet

4 participants

@rewritten

If the client is set to :raise_errors => true, then specific requests cannot override that value.

Use case: GoogleDocs API normally just returns data, but in some cases (e.g. resumable upload protocol) I need to access the exact error to know what to do next.

https://github.com/intridea/oauth2/blob/master/lib/oauth2/client.rb#L107:

raise e if opts[:raise_errors] || options[:raise_errors]

should be:

raise e if opts.fetch(:raise_errors, options[:raise_errors])

or

raise e if opts.has_key?(:raise_errors) ? opts[:raise_errors] : options[:raise_errors])

so it does not fallback with a false value.

@sent-hil

I wanted to know what error I got from Google as well, so I monkeypatched it to raise errors regardless.

# https://github.com/intridea/oauth2/blob/master/lib/oauth2/client.rb#L107
raise e #if opts[:raise_errors] || options[:raise_errors]

Not ideal, but it helped greatly.

@pierrevalade

What's the status on this? Seems like a decent issue.

@sferik sferik closed this Apr 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment