I have the following method:
@ExceptionHandler(InvalidPriceUpdateException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public String handleInvalidPriceUpdateException(InvalidPriceUpdateException e) throws JsonProcessingException {
return objectMapper.writeValueAsString(new HttpErrorDTO(e.getMessage()));
}
I see(in debug) that it invokes but in browser I see 500 error(instead of HttpStatus.BAD_REQUEST). and content of http response contains exception info(instead of HttpErrorDTO
structure).
What wrong in my code?