Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
4aede591
Commit
4aede591
authored
Mar 25, 2017
by
Greg Messner
Browse files
Modified handle() to only return the exception not throw it.
parent
577088d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/AbstractApi.java
View file @
4aede591
...
...
@@ -225,7 +225,8 @@ public abstract class AbstractApi {
}
/**
* Validates response.
* Validates response the response from the server against the expected HTTP status and
* the returned secret token, if either is not correct will throw a GitLabApiException.
*
* @param response response
* @param expected expected respone status
...
...
@@ -233,6 +234,7 @@ public abstract class AbstractApi {
* @throws GitLabApiException if HTTP status is not as expected, or the secret token doesn't match
*/
protected
Response
validate
(
Response
response
,
Response
.
Status
expected
)
throws
GitLabApiException
{
if
(
response
.
getStatus
()
!=
expected
.
getStatusCode
())
{
throw
new
GitLabApiException
(
response
);
}
...
...
@@ -245,17 +247,16 @@ public abstract class AbstractApi {
}
/**
* Wraps exception if needed
* Wraps
an
exception
in a GitLabApiException
if needed
.
*
* @param thrown the exception that should be wrapped
* @throws GitLabApiException containing the cause or GitLab API specific message
*/
protected
GitLabApiException
handle
(
Exception
thrown
)
throws
GitLabApiException
{
protected
GitLabApiException
handle
(
Exception
thrown
)
{
if
(
thrown
instanceof
GitLabApiException
)
{
throw
(
GitLabApiException
)
thrown
;
return
(
(
GitLabApiException
)
thrown
)
;
}
throw
new
GitLabApiException
(
thrown
);
return
(
new
GitLabApiException
(
thrown
)
)
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment