Class GitLabApiException

  • All Implemented Interfaces:
    java.io.Serializable

    public class GitLabApiException
    extends java.lang.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​(jakarta.ws.rs.core.Response response)
      Create a GitLabApiException instance based on the ClientResponse.
      GitLabApiException​(java.lang.Exception e)
      Create a GitLabApiException instance based on the exception.
      GitLabApiException​(java.lang.String message)
      Create a GitLabApiException instance with the specified message.
      GitLabApiException​(java.lang.String message, int httpStatus)
      Create a GitLabApiException instance with the specified message and HTTP status code.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> getHeaders()
      Returns the response headers.
      int getHttpStatus()
      Returns the HTTP status code that was the cause of the exception.
      java.lang.String getMessage()
      Get the message associated with the exception.
      java.lang.String getReason()
      Returns the HTTP status reason message, returns null if the causing error was not an HTTP related exception.
      java.util.Map<java.lang.String,​java.util.List<java.lang.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
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • GitLabApiException

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

        public GitLabApiException​(java.lang.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​(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

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

      • getMessage

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

        public final java.lang.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 java.util.Map<java.lang.String,​java.util.List<java.lang.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
      • getHeaders

        public final jakarta.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> 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()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object