3
3
import com .moplus .moplus_server .global .error .exception .BusinessException ;
4
4
import com .moplus .moplus_server .global .error .exception .ErrorCode ;
5
5
import com .moplus .moplus_server .global .error .exception .NotFoundException ;
6
+ import io .sentry .Sentry ;
6
7
import lombok .extern .slf4j .Slf4j ;
7
8
import org .springframework .http .HttpStatus ;
8
9
import org .springframework .http .ResponseEntity ;
@@ -20,6 +21,8 @@ protected ResponseEntity<ErrorResponse> handleBusinessException(final BusinessEx
20
21
log .error ("handleBusinessException" , exception );
21
22
final ErrorCode errorCode = exception .getErrorCode ();
22
23
final ErrorResponse response = ErrorResponse .from (errorCode );
24
+ Sentry .captureException (exception );
25
+
23
26
return new ResponseEntity <>(response , errorCode .getStatus ());
24
27
}
25
28
@@ -33,6 +36,7 @@ protected ResponseEntity<ErrorResponse> handleEntityNotFoundException(final NotF
33
36
log .error ("handleEntityNotFoundException" , exception );
34
37
final ErrorCode errorCode = exception .getErrorCode ();
35
38
final ErrorResponse response = ErrorResponse .from (exception .getErrorCode ());
39
+ Sentry .captureException (exception );
36
40
return new ResponseEntity <>(response , errorCode .getStatus ());
37
41
}
38
42
@@ -41,6 +45,7 @@ protected ResponseEntity<ErrorResponse> handleEntityNotFoundException(final NotF
41
45
protected ResponseEntity <ErrorResponse > handleException (final Exception exception ) {
42
46
log .error (exception .getMessage (), exception );
43
47
final ErrorResponse response = ErrorResponse .from (ErrorCode .INTERNAL_SERVER_ERROR );
48
+ Sentry .captureException (exception );
44
49
return new ResponseEntity <>(response , response .getStatus ());
45
50
}
46
51
}
0 commit comments