From: Kai Moritz Date: Sun, 10 Apr 2022 17:49:44 +0000 (+0200) Subject: Falschen Status-Code bei start/stop-Fehler korrigiert X-Git-Tag: deserialization-synchroner-test~16^2~7 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=fad71c8d35815986437b2d84422479e616b8745b;p=demos%2Fkafka%2Ftraining Falschen Status-Code bei start/stop-Fehler korrigiert --- diff --git a/src/main/java/de/juplo/kafka/DriverController.java b/src/main/java/de/juplo/kafka/DriverController.java index 28aa69f..a02fd2c 100644 --- a/src/main/java/de/juplo/kafka/DriverController.java +++ b/src/main/java/de/juplo/kafka/DriverController.java @@ -1,8 +1,10 @@ package de.juplo.kafka; import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import java.util.concurrent.ExecutionException; @@ -28,8 +30,9 @@ public class DriverController } @ExceptionHandler + @ResponseStatus(HttpStatus.BAD_REQUEST) public ErrorResponse illegalStateException(IllegalStateException e) { - return new ErrorResponse(e.getMessage(), 400); + return new ErrorResponse(e.getMessage(), HttpStatus.BAD_REQUEST.value()); } }