Adds backend handler for NullEmail and it's respected custom HttpCode.
This commit is contained in:
parent
25da5e97e5
commit
b691084d73
|
@ -0,0 +1,19 @@
|
|||
package eu.eudat.controllers.controllerhandler;
|
||||
|
||||
import eu.eudat.exceptions.security.NullEmailException;
|
||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||
import eu.eudat.types.ApiMessageCode;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
||||
@ControllerAdvice
|
||||
@Order(2)
|
||||
public class ControllerUserNullEmailHandler {
|
||||
|
||||
@ExceptionHandler(NullEmailException.class)
|
||||
public ResponseEntity nullEmailException(Exception ex) throws Exception {
|
||||
return ResponseEntity.status(ApiMessageCode.NULL_EMAIL.getValue()).body("");
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ package eu.eudat.types;
|
|||
|
||||
public enum ApiMessageCode {
|
||||
NO_MESSAGE(0), SUCCESS_MESSAGE(200), WARN_MESSAGE(300), ERROR_MESSAGE(400),
|
||||
DEFAULT_ERROR_MESSAGE(444), VALIDATION_MESSAGE(445), UNSUCCESS_DELETE(674);
|
||||
DEFAULT_ERROR_MESSAGE(444), VALIDATION_MESSAGE(445),NULL_EMAIL(480), UNSUCCESS_DELETE(674);
|
||||
|
||||
private Integer value;
|
||||
|
||||
|
@ -26,6 +26,8 @@ public enum ApiMessageCode {
|
|||
return ERROR_MESSAGE;
|
||||
case 444:
|
||||
return DEFAULT_ERROR_MESSAGE;
|
||||
case 480:
|
||||
return NULL_EMAIL;
|
||||
case 674:
|
||||
return UNSUCCESS_DELETE;
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue