Class PsaRstApiErrFac

java.lang.Object
de.pisa.psa.rst.obj.PsaRstApiErrFac

public class PsaRstApiErrFac extends Object
REST API: error factory
Since:
21.06.2023
Author:
weiland
  • Constructor Details

    • PsaRstApiErrFac

      public PsaRstApiErrFac(PsaRstApiErrCod code)
      Constructor
      Parameters:
      code - error code
    • PsaRstApiErrFac

      public PsaRstApiErrFac(javax.ws.rs.core.Response.StatusType status)
      Constructor
      Parameters:
      status - status code
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • setErrorCode

      public final PsaRstApiErrFac setErrorCode(String code)
      set the error code
      Parameters:
      code - code
      Returns:
      this
    • setErrorMessage

      public final PsaRstApiErrFac setErrorMessage(String message)
      set the error message
      Parameters:
      message - message
      Returns:
      this
    • addDetail

      public PsaRstApiErrFac addDetail(String key, String value)
      add a detail
      Parameters:
      key - key
      value - value
      Returns:
      this
    • addEventGid

      public PsaRstApiErrFac addEventGid(PsaRstApiEvtHdl handler)
      Add the event GID to the details. The key will be eventGid
      Parameters:
      handler - event handler
      Returns:
      this
    • addEventGid

      public PsaRstApiErrFac addEventGid(PsaRstApiEvtHdlDat data)
      Add the event GID to the details. The key will be eventGid
      Parameters:
      data - event handler data
      Returns:
      this
    • buildError

      public PsaRstApiErr buildError()
      build a new error instance where the placeholders in the message ore replaced
      Returns:
      error
    • throwError

      public void throwError() throws javax.ws.rs.ClientErrorException, javax.ws.rs.ServerErrorException
      throw a web exception
      Throws:
      javax.ws.rs.ClientErrorException - if the response has a 4XX status
      javax.ws.rs.ServerErrorException - if the response has a 5XX status
      RuntimeException - if the response has not a status of 4XX or 5XX