File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
src/main/java/com/moing/backend/global/config/slack/exception Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .moing .backend .global .config .slack .exception ;
2
+
3
+ import com .moing .backend .global .config .slack .exception .dto .ExceptionEvent ;
4
+ import com .moing .backend .global .config .slack .util .WebhookUtil ;
5
+ import lombok .RequiredArgsConstructor ;
6
+ import org .springframework .context .event .EventListener ;
7
+ import org .springframework .scheduling .annotation .Async ;
8
+ import org .springframework .stereotype .Component ;
9
+
10
+ @ RequiredArgsConstructor
11
+ @ Component
12
+ public class ExceptionEventHandler {
13
+
14
+ private final WebhookUtil webhookUtil ;
15
+
16
+ @ Async ("asyncTaskExecutor" )
17
+ @ EventListener
18
+ public void onExceptionEvent (ExceptionEvent event ) {
19
+ webhookUtil .sendSlackAlertErrorLog (event .getRequest (), event .getException ());
20
+ }
21
+ }
Original file line number Diff line number Diff line change
1
+ package com .moing .backend .global .config .slack .exception .dto ;
2
+
3
+ import lombok .AllArgsConstructor ;
4
+ import lombok .Getter ;
5
+
6
+ import javax .servlet .http .HttpServletRequest ;
7
+
8
+ @ Getter
9
+ @ AllArgsConstructor
10
+ public class ExceptionEvent {
11
+
12
+ private final HttpServletRequest request ;
13
+ private final Exception exception ;
14
+ }
You can’t perform that action at this time.
0 commit comments