Class ErrorMessage

java.lang.Object
io.goobi.viewer.api.rest.model.ErrorMessage
All Implemented Interfaces:
IResponseMessage

public class ErrorMessage extends Object implements IResponseMessage
REST API response model that carries an HTTP status code, a human-readable error description, and an optional stack trace. Implements IResponseMessage and is serialized as JSON for error responses.
Author:
Florian Alpers
  • Constructor Details

    • ErrorMessage

      public ErrorMessage()
    • ErrorMessage

      public ErrorMessage(int status, String message)
      Creates a new ErrorMessage instance.
      Parameters:
      status - HTTP status code of the error response
      message - human-readable error description
    • ErrorMessage

      public ErrorMessage(int status, String message, String stackTrace)
      Creates a new ErrorMessage instance.
      Parameters:
      status - HTTP status code of the error response
      message - human-readable error description
      stackTrace - stack trace string for diagnostic purposes
    • ErrorMessage

      public ErrorMessage(RestApiException exception)
      Creates a new ErrorMessage instance.
      Parameters:
      exception - REST API exception carrying status code and message
  • Method Details

    • getStatus

      public int getStatus()
      Getter for the field status.
      Returns:
      the HTTP status code of this error response
    • getMessage

      public String getMessage()
      Getter for the field message.
      Specified by:
      getMessage in interface IResponseMessage
      Returns:
      the human-readable error description
    • getStackTrace

      public String getStackTrace()
      Getter for the field stackTrace.
      Returns:
      the stack trace string for diagnostic purposes, or null if not set