Package de.pisa.psa.rst.obj
Class PsaRstApiErrFac
- java.lang.Object
-
- de.pisa.psa.rst.obj.PsaRstApiErrFac
-
public class PsaRstApiErrFac extends java.lang.Object
REST API: error factory- Since:
- 21.06.2023
- Author:
- weiland
-
-
Constructor Summary
Constructors Constructor Description PsaRstApiErrFac(PsaRstApiErrCod code)
ConstructorPsaRstApiErrFac(javax.ws.rs.core.Response.Status status)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PsaRstApiErrFac
addDetail(java.lang.String key, java.lang.String value)
add a detailPsaRstApiErr
buildError()
build a new error instance where the placeholders in the message ore replacedPsaRstApiErrFac
setErrorCode(java.lang.String code)
set the error codePsaRstApiErrFac
setErrorMessage(java.lang.String message)
set the error messagevoid
throwError()
throw a web exceptionjava.lang.String
toString()
-
-
-
Constructor Detail
-
PsaRstApiErrFac
public PsaRstApiErrFac(PsaRstApiErrCod code)
Constructor- Parameters:
code
- error code
-
PsaRstApiErrFac
public PsaRstApiErrFac(javax.ws.rs.core.Response.Status status)
Constructor- Parameters:
status
- status code
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
setErrorCode
public PsaRstApiErrFac setErrorCode(java.lang.String code)
set the error code- Parameters:
code
- code- Returns:
- this
-
setErrorMessage
public PsaRstApiErrFac setErrorMessage(java.lang.String message)
set the error message- Parameters:
message
- message- Returns:
- this
-
addDetail
public PsaRstApiErrFac addDetail(java.lang.String key, java.lang.String value)
add a detail- Parameters:
key
- keyvalue
- value- 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 statusjavax.ws.rs.ServerErrorException
- if the response has a 5XX statusjava.lang.RuntimeException
- if the response has not a status of 4XX or 5XX
-
-