Package org.gitlab4j.api
Class GitLabApiException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.gitlab4j.api.GitLabApiException
- All Implemented Interfaces:
Serializable
public class GitLabApiException extends Exception
This is the exception that will be thrown if any exception occurs while communicating
with a GitLab API endpoint.
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description GitLabApiException(Exception e)
Create a GitLabApiException instance based on the exception.GitLabApiException(String message)
Create a GitLabApiException instance with the specified message.GitLabApiException(String message, int httpStatus)
Create a GitLabApiException instance with the specified message and HTTP status code.GitLabApiException(javax.ws.rs.core.Response response)
Create a GitLabApiException instance based on the ClientResponse. -
Method Summary
Modifier and Type Method Description boolean
equals(Object obj)
int
getHttpStatus()
Returns the HTTP status code that was the cause of the exception. returns 0 if the causing error was not an HTTP related exceptionString
getMessage()
Get the message associated with the exception.String
getReason()
Returns the HTTP status reason message, returns null if the causing error was not an HTTP related exception.Map<String,List<String>>
getValidationErrors()
Returns a Map<String, List<String>> instance containing validation errors if this GitLabApiException was caused by validation errors on the GitLab server, otherwise returns null.int
hashCode()
boolean
hasValidationErrors()
Returns true if this GitLabApiException was caused by validation errors on the GitLab server, otherwise returns false.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GitLabApiException
Create a GitLabApiException instance with the specified message.- Parameters:
message
- the message for the exception
-
GitLabApiException
Create a GitLabApiException instance with the specified message and HTTP status code.- Parameters:
message
- the message for the exceptionhttpStatus
- the HTTP status code for the exception
-
GitLabApiException
public GitLabApiException(javax.ws.rs.core.Response response)Create a GitLabApiException instance based on the ClientResponse.- Parameters:
response
- the JAX-RS response that caused the exception
-
GitLabApiException
Create a GitLabApiException instance based on the exception.- Parameters:
e
- the Exception to wrap
-
-
Method Details
-
getMessage
Get the message associated with the exception.- Overrides:
getMessage
in classThrowable
- Returns:
- the message associated with the exception
-
getReason
Returns the HTTP status reason message, returns null if the causing error was not an HTTP related exception.- Returns:
- the HTTP status reason message
-
getHttpStatus
public final int getHttpStatus()Returns the HTTP status code that was the cause of the exception. returns 0 if the causing error was not an HTTP related exception- Returns:
- the HTTP status code, returns 0 if the causing error was not an HTTP related exception
-
hasValidationErrors
public boolean hasValidationErrors()Returns true if this GitLabApiException was caused by validation errors on the GitLab server, otherwise returns false.- Returns:
- true if this GitLabApiException was caused by validation errors on the GitLab server, otherwise returns false
-
getValidationErrors
Returns a Map<String, List<String>> instance containing validation errors if this GitLabApiException was caused by validation errors on the GitLab server, otherwise returns null.- Returns:
- a Map<String, List<String>> instance containing validation errors if this GitLabApiException was caused by validation errors on the GitLab server, otherwise returns null
-
hashCode
public int hashCode() -
equals
-