Class ErrorResponse

java.lang.Object
org.apache.gravitino.dto.responses.BaseResponse
org.apache.gravitino.dto.responses.ErrorResponse
All Implemented Interfaces:
RESTMessage, RESTResponse

public class ErrorResponse extends BaseResponse
Represents an error response.
  • Method Details

    • validate

      public void validate()
      Validates the error response.
      Specified by:
      validate in interface RESTMessage
      Overrides:
      validate in class BaseResponse
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • restError

      public static ErrorResponse restError(String message)
      Creates a new rest error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      Returns:
      The new instance.
    • illegalArguments

      public static ErrorResponse illegalArguments(String message)
      Create a new illegal arguments error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      Returns:
      The new instance.
    • illegalArguments

      public static ErrorResponse illegalArguments(String message, Throwable throwable)
      Create a new illegal arguments error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.
    • illegalArguments

      public static ErrorResponse illegalArguments(String type, String message, Throwable throwable)
      Create a new illegal arguments error instance of ErrorResponse.
      Parameters:
      type - The type of the error.
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.
    • connectionFailed

      public static ErrorResponse connectionFailed(String message)
      Create a new connection failed error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      Returns:
      The new instance.
    • connectionFailed

      public static ErrorResponse connectionFailed(String message, Throwable throwable)
      Create a new connection failed error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.
    • notFound

      public static ErrorResponse notFound(String type, String message)
      Create a new not found error instance of ErrorResponse.
      Parameters:
      type - The type of the error.
      message - The message of the error.
      Returns:
      The new instance.
    • notFound

      public static ErrorResponse notFound(String type, String message, Throwable throwable)
      Create a new not found error instance of ErrorResponse.
      Parameters:
      type - The type of the error.
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.
    • internalError

      public static ErrorResponse internalError(String message)
      Create a new internal error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      Returns:
      The new instance.
    • internalError

      public static ErrorResponse internalError(String message, Throwable throwable)
      Create a new internal error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.
    • alreadyExists

      public static ErrorResponse alreadyExists(String type, String message)
      Create a new already exists error instance of ErrorResponse.
      Parameters:
      type - The type of the error.
      message - The message of the error.
      Returns:
      The new instance.
    • alreadyExists

      public static ErrorResponse alreadyExists(String type, String message, Throwable throwable)
      Create a new already exists error instance of ErrorResponse.
      Parameters:
      type - The type of the error.
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.
    • notInUse

      public static ErrorResponse notInUse(String type, String message, Throwable throwable)
      Create a new not in use error instance of ErrorResponse.
      Parameters:
      type - The type of the error.
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.
    • inUse

      public static ErrorResponse inUse(String type, String message, Throwable throwable)
      Create a new entity in use error instance of ErrorResponse.
      Parameters:
      type - The type of the error.
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.
    • nonEmpty

      public static ErrorResponse nonEmpty(String type, String message)
      Create a new non-empty error instance of ErrorResponse.
      Parameters:
      type - The type of the error.
      message - The message of the error.
      Returns:
      The new instance.
    • nonEmpty

      public static ErrorResponse nonEmpty(String type, String message, Throwable throwable)
      Create a new non-empty error instance of ErrorResponse.
      Parameters:
      type - The type of the error.
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.
    • unknownError

      public static ErrorResponse unknownError(String message)
      Create a new unknown error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      Returns:
      The new instance.
    • oauthError

      public static ErrorResponse oauthError(int code, String type, String message)
      Create a new oauth error instance of ErrorResponse.
      Parameters:
      code - The code of the error.
      type - The type of the error.
      message - The message of the error.
      Returns:
      The new instance.
    • unsupportedOperation

      public static ErrorResponse unsupportedOperation(String message)
      Create a new unsupported operation error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      Returns:
      The new instance.
    • unsupportedOperation

      public static ErrorResponse unsupportedOperation(String message, Throwable throwable)
      Create a new unsupported operation error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.
    • forbidden

      public static ErrorResponse forbidden(String message, Throwable throwable)
      Create a new forbidden operation error instance of ErrorResponse.
      Parameters:
      message - The message of the error.
      throwable - The throwable that caused the error.
      Returns:
      The new instance.