Package de.pisa.psa.rst.obj
Class PsaRstApiErrFac
java.lang.Object
de.pisa.psa.rst.obj.PsaRstApiErrFac
REST API: error factory
- Since:
- 21.06.2023
- Author:
- weiland
-
Constructor Summary
ConstructorsConstructorDescriptionConstructorPsaRstApiErrFac
(javax.ws.rs.core.Response.StatusType status) Constructor -
Method Summary
Modifier and TypeMethodDescriptionadd a detailbuild a new error instance where the placeholders in the message ore replacedsetErrorCode
(String code) set the error codesetErrorMessage
(String message) set the error messagevoid
throw a web exceptiontoString()
-
Constructor Details
-
PsaRstApiErrFac
Constructor- Parameters:
code
- error code
-
PsaRstApiErrFac
public PsaRstApiErrFac(javax.ws.rs.core.Response.StatusType status) Constructor- Parameters:
status
- status code
-
-
Method Details
-
toString
-
setErrorCode
set the error code- Parameters:
code
- code- Returns:
- this
-
setErrorMessage
set the error message- Parameters:
message
- message- Returns:
- this
-
addDetail
add a detail- Parameters:
key
- keyvalue
- value- Returns:
- this
-
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.ServerErrorExceptionthrow a web exception- Throws:
javax.ws.rs.ClientErrorException
- if the response has a 4XX statusjavax.ws.rs.ServerErrorException
- if the response has a 5XX statusRuntimeException
- if the response has not a status of 4XX or 5XX
-