You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The generic error class `Github::Error::GithubError` will handle both the client (`Github::Error::ClientError`) and service (`Github::Error::ServiceError`) side errors. For instance in your code you can catch errors like
589
+
The generic error class `Github::Error::GithubError` will handle both the client (`Github::Error::ClientError`) and service (`Github::Error::ServiceError`) side errors.
590
+
591
+
For instance in your code you can catch errors like
586
592
587
593
```ruby
588
594
begin
589
595
# Do something with github_api gem
590
596
rescueGithub::Error::GithubError => e
591
597
puts e.message
592
-
593
598
if e.is_a? Github::Error::ServiceError
594
599
# handle GitHub service errors such as 404
595
600
elsif e.is_a? Github::Error::ClientError
@@ -598,6 +603,24 @@ rescue Github::Error::GithubError => e
598
603
end
599
604
```
600
605
606
+
### 5.1 Client Error
607
+
608
+
Any time **Github** client has a problem sending request a `Github::Error::ClientError` is raised that will provide a summary of the problem and possible solutions.
609
+
610
+
### 5.2 Service Error
611
+
612
+
When the **Github** client receives a HTTP response from GitHub service that indicates error then `Github::Error::ServiceError` is raised.
613
+
614
+
There are number of specific error types such as `Github::Error::NotAcceptable` when `406` status code is returned.
615
+
616
+
#### 5.2.1 Data
617
+
618
+
When `Github::Error::ServiceError` is raised you can call `data` to access it payload in JSON format.
619
+
620
+
#### 5.2.2 Error messages
621
+
622
+
Anytime there are error messages provided with `Github::Error::ServiceError` you can access them by calling `error_messages` helper.
0 commit comments