Comments (5)
Hi Darren, yeah this looks too brittle for what it needs to be. I will try to tackle this one and simplify it asap, however in the meantime if you have any suggestions how this should be handled please send in a patch. Thanks Piotr
from github.
Thank you for your feedback. I may send you a patch when I have time :)
from github.
Hi Darren, I've spent some time on this issue and rewrote the error handling to always return a string message. All the response decoding and message extraction now happens inside the gem, therefore your code can be simplified as follows:
begin
#Do something with github_api gem
rescue Github::Error::GithubError => e
puts e.message => #e.g. 'key is already in use'
end
Please note that you can further refine your error catching to only GitHub service errors by using Github::Error::ServiceError
etc.. plus I've updated the README with error handling information for future reference.
I hope this helps. Please download the v0.6.4 gem release and let us know if that's working for you?
P
from github.
I tried it out and it works! The message content includes the HTTP verb and the url (as well as the error message) by the way, for example, I received: "POST https://api.github.com/repos/jensendarren/try_git/keys?access_token=003betc7uwehblahblah7wj: 422 key is already in use"
Anyway, e.message.class is now a String which is great! Thanks Peter!
from github.
Awesome, I figured that having the explicit request information together with error message will make it more convenient for future debugging. Glad it works for you.
from github.
Related Issues (20)
- repo forked path HOT 1
- No support for Check Runs HOT 1
- Cannot seem to upload asset
- Support traffic queries HOT 1
- Review Request API HOT 1
- Support preview media types, (create repository from template) HOT 1
- Uploading compressed asset seems to be corrupt while using the API
- Deprecation warning for Faraday::Error::ClientError
- add_dependency could cause problems HOT 1
- Dependency resolution HOT 2
- Unable to list private repositories HOT 3
- Support new deployment statuses HOT 1
- Get repo by tag HOT 1
- GitHub deprecation notice for authentication via URL query parameters HOT 2
- Gummyg
- Does Not Work With Ruby 3.0 Unless Using Faraday 1.3 HOT 1
- About section website link incorrect HOT 1
- Can I perform a search query? HOT 1
- Support for Oauth2 v2.x HOT 1
- Hi
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from github.