File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/main/java/com/example/treaders/ExceptionHandling Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .example .treaders .ExceptionHandling ;
2+
3+ import org .springframework .web .bind .annotation .ExceptionHandler ;
4+ import org .springframework .web .bind .annotation .RestControllerAdvice ;
5+ import org .springframework .web .servlet .mvc .method .annotation .ResponseEntityExceptionHandler ;
6+
7+ import java .io .IOException ;
8+
9+ @ RestControllerAdvice
10+ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
11+ @ ExceptionHandler (IOException .class )
12+ public void handleIOException (IOException ex ) {
13+ // Log the exception or handle it as per your application's requirements
14+ // For example:
15+ System .err .println ("IOException occurred: " + ex .getMessage ());
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments