1
Ich habe die folgende Methode:Exception ruft aber keinen Einfluss auf http-Antwort
@ExceptionHandler(InvalidPriceUpdateException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public String handleInvalidPriceUpdateException(InvalidPriceUpdateException e) throws JsonProcessingException {
return objectMapper.writeValueAsString(new HttpErrorDTO(e.getMessage()));
}
I (in debug) sehen, dass es ruft aber in Browser sehe ich 500-Fehler (statt HttpStatus.BAD_REQUEST). und der Inhalt der HTTP-Antwort enthält Ausnahmeinformationen (anstelle der Struktur HttpErrorDTO
).
Was ist falsch in meinem Code?