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

Octokit.commits raises Faraday::Error::ResourceNotFound #39

Closed
koraktor opened this issue Jun 14, 2011 · 6 comments
Closed

Octokit.commits raises Faraday::Error::ResourceNotFound #39

koraktor opened this issue Jun 14, 2011 · 6 comments

Comments

@koraktor
Copy link
Contributor

According to lib/faraday/response/raise_error.rb this should never happen.

It happens for me with all my Rubies, all of them having Octokit 0.6.3 and Faraday 0.6.1 installed. So I made the mistake and rescue Faraday::Error::ResourceNotFound where Octokit::NotFound would be correct. One of my users gets the Octokit::NotFound instead.

I don't really get why Faraday::Error::ResourceNotFound is raised on my setup.

@koraktor
Copy link
Contributor Author

Strange, doing a plain ruby fails while bundle exec ruby works like expected with Octokit::NotFound. The versions of Octokit and Faraday are the same for both invocations.

@sferik
Copy link
Member

sferik commented Jun 15, 2011

I'm guessing you have Faraday 0.7 installed on your system, which includes its own RaiseError class that's getting loaded before the Octokit RaiseError class. I'll work on a patch.

@sferik sferik closed this as completed in f52bc90 Jun 15, 2011
@koraktor
Copy link
Contributor Author

No, only Faraday 0.6.1 (which is loaded) and 0.5.7 are installed. But 0.6.1 has a faraday/response/raise_error.rb too, so I guess this might help. Will test this.

Will there be a new version including this fix?

@koraktor
Copy link
Contributor Author

Just tried the code in master giving me the following error which might be related:

/Library/Ruby/Gems/1.8/gems/multi_json-1.0.3/lib/multi_json/engines/yajl.rb:10:in `parse': input must be a string or IO (MultiJson::DecodeError)
    from /Library/Ruby/Gems/1.8/gems/multi_json-1.0.3/lib/multi_json/engines/yajl.rb:10:in `decode'
    from /Library/Ruby/Gems/1.8/gems/multi_json-1.0.3/lib/multi_json.rb:65:in `decode'
    from /Library/Ruby/Gems/1.8/gems/octokit-0.6.3/lib/faraday/response/raise_octokit_error.rb:35:in `error_message'
    from /Library/Ruby/Gems/1.8/gems/octokit-0.6.3/lib/faraday/response/raise_octokit_error.rb:16:in `on_complete'
    ...

The input, i.e. body in error_message is <#Hashie::Rash error="Not Found">.

At least the right on_complete method is now called.

koraktor added a commit to koraktor/octokit that referenced this issue Jun 16, 2011
The response may be decoded already. See issue octokit#39 for a sample of this
bug.
@catsby
Copy link
Contributor

catsby commented Jun 16, 2011

Can you provide the repository you're trying this with? I can't seem to reproduce the error. I've tried Octokit 0.6.3 and the code from master

@koraktor
Copy link
Contributor Author

It's not a repository specific error, it's a load path issue. But that has been fixed by @sferik's commit (f52bc90).

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

3 participants