From b1cb8a8ff87930ae164f68e65050bfec96a2f053 Mon Sep 17 00:00:00 2001 From: Clover Song Date: Sun, 15 Dec 2024 21:09:48 +0900 Subject: [PATCH] feat: error test --- .../main/java/kr/mafoo/photo/config/WebExceptionHandler.java | 2 +- .../java/kr/mafoo/photo/controller/SumoneController.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/photo-service/src/main/java/kr/mafoo/photo/config/WebExceptionHandler.java b/photo-service/src/main/java/kr/mafoo/photo/config/WebExceptionHandler.java index 3b27e99..1a79d9d 100644 --- a/photo-service/src/main/java/kr/mafoo/photo/config/WebExceptionHandler.java +++ b/photo-service/src/main/java/kr/mafoo/photo/config/WebExceptionHandler.java @@ -113,7 +113,7 @@ private Mono> handleExceptionInternal(ServerWebExchange e if (status == HttpStatus.INTERNAL_SERVER_ERROR) { return slackService.sendErrorNotification( requestMemberId, method, fullPath, requestBody, originIp, userAgent, exception.getMessage() - ).then(Mono.just(new ResponseEntity<>("Internal Server Error", status))); + ).then(Mono.error(exception)); } return Mono.just(new ResponseEntity<>(status.getReasonPhrase(), status)); diff --git a/photo-service/src/main/java/kr/mafoo/photo/controller/SumoneController.java b/photo-service/src/main/java/kr/mafoo/photo/controller/SumoneController.java index 21db1d6..72d33f0 100644 --- a/photo-service/src/main/java/kr/mafoo/photo/controller/SumoneController.java +++ b/photo-service/src/main/java/kr/mafoo/photo/controller/SumoneController.java @@ -162,4 +162,9 @@ Mono getInviteCode( .findById(userId) .map(SumoneInviteCodeResponse::fromEntity); } + + @PostMapping("/error") + Mono error() { + return Mono.error(new RuntimeException("error")); + } }