-
Notifications
You must be signed in to change notification settings - Fork 0
ApplicationException
< R > is the type Of Exception that you can return From Method
R createApplicationException(String exceptionKey);
this method create An RunTime Exception
exceptionKey this key that fetch from Resource properties And the Object Of Exception Class that you can throw it
R createApplicationException(Message);
message is the Object of message that you must impl it
return the Object Of Exception Class that you can throw it
Notification createApplicationWarning(Message);
message is the Object of message that you must impl it
return the Object Of notification Class
List createApplicationWarning(Message[] messages);
messages is the Object of message that you must impl it
return the Object Of notification Class
R createApplicationException(String exceptionKey, HttpStatus)
this key that fetch from Resource properties
httpStatus is the status of Http Response
R createApplicationException(Message, HttpStatus)
is the Object of message that you must impl it {@link Message}
is the status of Http Response {@link org.springframework.http.HttpStatus}
return the Object Of Exception Class that you can throw it
public BaseDTO<R> findById(@NotNull I id) {
T t = generalRepository.findById(id).orElseThrow(
() -> applicationException.createApplicationException(ExceptionEnum.NOTFOUND, HttpStatus.NOT_FOUND)
);
return generalMapper.mapBaseObjectToResponse(t);
}