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
2b2aaf0e
Commit
2b2aaf0e
authored
Mar 16, 2014
by
Greg Messner
Browse files
Initial check-in.
parent
1d68180a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/messners/gitlab/api/GitLabApiException.java
0 → 100644
View file @
2b2aaf0e
package
com.messners.gitlab.api
;
import
javax.ws.rs.core.Response.StatusType
;
import
com.messners.gitlab.api.models.ErrorMessage
;
import
com.sun.jersey.api.client.ClientResponse
;
public
class
GitLabApiException
extends
Exception
{
private
static
final
long
serialVersionUID
=
1L
;
private
StatusType
statusInfo
;
private
String
message
;
/**
*
* @param response
*/
public
GitLabApiException
(
ClientResponse
response
)
{
super
();
statusInfo
=
response
.
getStatusInfo
();
if
(
response
.
hasEntity
())
{
try
{
ErrorMessage
errorMessage
=
response
.
getEntity
(
ErrorMessage
.
class
);
message
=
errorMessage
.
getMessage
();
}
catch
(
Exception
ignore
)
{}
}
}
public
GitLabApiException
(
Exception
e
)
{
super
(
e
);
message
=
e
.
getMessage
();
}
/**
*
*/
@Override
public
final
String
getMessage
()
{
return
(
message
!=
null
?
message
:
statusInfo
.
getReasonPhrase
());
}
/**
*
* @return
*/
public
final
String
getReason
()
{
return
(
statusInfo
.
getReasonPhrase
());
}
/**
*
* @return
*/
public
final
int
getHttpStatus
()
{
return
(
statusInfo
.
getStatusCode
());
}
}
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