Package org.gitlab4j.api
Class GitLabApiException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.gitlab4j.api.GitLabApiException
- All Implemented Interfaces:
Serializable
This is the exception that will be thrown if any exception occurs while communicating
with a GitLab API endpoint.
- See Also:
-
Constructor Summary
ConstructorDescriptionGitLabApiException
(jakarta.ws.rs.core.Response response) Create a GitLabApiException instance based on the ClientResponse.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. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the response headers.final int
Returns the HTTP status code that was the cause of the exception. returns 0 if the causing error was not an HTTP related exceptionfinal String
Get the message associated with the exception.final String
Returns the HTTP status reason message, returns null if the causing error was not an HTTP related exception.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
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(jakarta.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
-
getHeaders
Returns the response headers. Returns null if the causing error was not a response related exception.- Returns:
- the response headers or null.
-
hashCode
public int hashCode() -
equals
-