Skip to content

Commit 4858907

Browse files
committed
Rename exception for "Internal Server Error".
1 parent 0168eea commit 4858907

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/main/java/com/github/hrytsenko/jsondata/springboot/error/ExceptionAdvices.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ public ErrorResponse onNotFound(ServiceException.NotFound exception) {
9191
return ErrorResponse.create(exception.getCode(), correlationSource.getCorrelation());
9292
}
9393

94-
@ExceptionHandler(ServiceException.InternalServer.class)
94+
@ExceptionHandler(ServiceException.InternalError.class)
9595
@ResponseStatus(code = HttpStatus.INTERNAL_SERVER_ERROR)
96-
public ErrorResponse onInternalError(ServiceException.InternalServer exception) {
96+
public ErrorResponse onInternalError(ServiceException.InternalError exception) {
9797
log.error("Internal error", exception);
9898
return ErrorResponse.create(exception.getCode(), correlationSource.getCorrelation());
9999
}

src/main/java/com/github/hrytsenko/jsondata/springboot/error/ServiceException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ public NotFound(Throwable cause) {
8181

8282
}
8383

84-
public static class InternalServer extends ServiceException {
84+
public static class InternalError extends ServiceException {
8585

86-
public InternalServer(String code) {
86+
public InternalError(String code) {
8787
super(code);
8888
}
8989

90-
public InternalServer(String code, Throwable cause) {
90+
public InternalError(String code, Throwable cause) {
9191
super(code, cause);
9292
}
9393

src/main/java/com/github/hrytsenko/jsondata/springboot/error/WrapErrorsAspect.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public Object handle(ProceedingJoinPoint point, WrapErrors config) {
3333
} catch (ServiceException exception) {
3434
throw exception;
3535
} catch (Exception exception) {
36-
throw new ServiceException.InternalServer(config.value(), exception);
36+
throw new ServiceException.InternalError(config.value(), exception);
3737
}
3838
}
3939

src/test/java/com/github/hrytsenko/jsondata/springboot/error/ExceptionAdvicesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void serviceExceptionAdvice_onNotFound() {
100100
void serviceExceptionAdvice_onInternalError() {
101101
ExceptionAdvices.ServiceExceptionAdvice advice = new ExceptionAdvices.ServiceExceptionAdvice(correlationSource);
102102

103-
ServiceException.InternalServer sourceException = new ServiceException.InternalServer("INTERNAL_ERROR");
103+
ServiceException.InternalError sourceException = new ServiceException.InternalError("INTERNAL_ERROR");
104104

105105
ExceptionAdvices.ErrorResponse actualResponse = advice.onInternalError(sourceException);
106106

src/test/java/com/github/hrytsenko/jsondata/springboot/error/WrapErrorsAspectTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void handle_customException() {
4747
ProceedingJoinPoint sourceJoinPoint = mockJoinPoint(sourceException);
4848
WrapErrors sourceConfig = Mockito.mock(WrapErrors.class);
4949

50-
Assertions.assertThrows(ServiceException.InternalServer.class,
50+
Assertions.assertThrows(ServiceException.InternalError.class,
5151
() -> aspect.handle(sourceJoinPoint, sourceConfig));
5252
}
5353

0 commit comments

Comments
 (0)