Skip to content

Commit 5fe2457

Browse files
committed
refactor error handling
1 parent 6400581 commit 5fe2457

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

backend/spring-boot/src/main/java/org/bugzkit/api/shared/config/SecurityConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.bugzkit.api.auth.security.JWTFilter;
77
import org.bugzkit.api.auth.security.UserDetailsServiceImpl;
88
import org.bugzkit.api.shared.constants.Path;
9-
import org.bugzkit.api.shared.error.handling.CustomAuthenticationEntryPoint;
9+
import org.bugzkit.api.shared.error.CustomAuthenticationEntryPoint;
1010
import org.springframework.context.annotation.Bean;
1111
import org.springframework.context.annotation.Configuration;
1212
import org.springframework.http.HttpMethod;

backend/spring-boot/src/main/java/org/bugzkit/api/shared/error/handling/CustomAuthenticationEntryPoint.java renamed to backend/spring-boot/src/main/java/org/bugzkit/api/shared/error/CustomAuthenticationEntryPoint.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
package org.bugzkit.api.shared.error.handling;
1+
package org.bugzkit.api.shared.error;
22

33
import com.google.common.net.HttpHeaders;
44
import jakarta.servlet.http.HttpServletRequest;
55
import jakarta.servlet.http.HttpServletResponse;
66
import java.io.IOException;
77
import java.util.UUID;
88
import lombok.extern.slf4j.Slf4j;
9-
import org.bugzkit.api.shared.error.ErrorMessage;
109
import org.bugzkit.api.shared.message.service.MessageService;
1110
import org.slf4j.MDC;
1211
import org.springframework.http.HttpStatus;

backend/spring-boot/src/main/java/org/bugzkit/api/shared/error/handling/CustomExceptionHandler.java renamed to backend/spring-boot/src/main/java/org/bugzkit/api/shared/error/GlobalExceptionHandler.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
package org.bugzkit.api.shared.error.handling;
1+
package org.bugzkit.api.shared.error;
22

33
import jakarta.annotation.Nonnull;
44
import lombok.extern.slf4j.Slf4j;
5-
import org.bugzkit.api.shared.error.ErrorMessage;
65
import org.bugzkit.api.shared.error.exception.BadRequestException;
76
import org.bugzkit.api.shared.error.exception.ConflictException;
87
import org.bugzkit.api.shared.error.exception.ResourceNotFoundException;
@@ -30,10 +29,10 @@
3029

3130
@Slf4j
3231
@ControllerAdvice
33-
public class CustomExceptionHandler extends ResponseEntityExceptionHandler {
32+
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
3433
private final MessageService messageService;
3534

36-
public CustomExceptionHandler(MessageService messageService) {
35+
public GlobalExceptionHandler(MessageService messageService) {
3736
this.messageService = messageService;
3837
}
3938

docs/src/content/how-it-works/error-handling.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ These constants are what get sent to the frontend.
4444

4545
#### Exception Handler
4646

47-
`CustomExceptionHandler` is a `@ControllerAdvice` that catches all exceptions and converts them into a consistent response format:
47+
`GlobalExceptionHandler` is a `@ControllerAdvice` that catches all exceptions and converts them into a consistent response format:
4848

4949
```json
5050
{

0 commit comments

Comments
 (0)