Class 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 Detail

      • GitLabApiException

        public GitLabApiException​(String message)
        Create a GitLabApiException instance with the specified message.
        Parameters:
        message - the message for the exception
      • GitLabApiException

        public GitLabApiException​(String message,
                                  int httpStatus)
        Create a GitLabApiException instance with the specified message and HTTP status code.
        Parameters:
        message - the message for the exception
        httpStatus - 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

        public GitLabApiException​(Exception e)
        Create a GitLabApiException instance based on the exception.
        Parameters:
        e - the Exception to wrap
    • Method Detail

      • getMessage

        public final String getMessage()
        Get the message associated with the exception.
        Overrides:
        getMessage in class Throwable
        Returns:
        the message associated with the exception
      • getReason

        public final String 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

        public 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.
        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()
        Overrides:
        hashCode in class Object