Skip to content

Commit

Permalink
Add exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
pavetok committed Mar 17, 2024
1 parent af86ff0 commit 23a1a80
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public RegistrationResponse register(RegistrationRequest request) {
public ViewingResponse view(SepulkaMessageDm.ViewingRequest request) {
LOG.debug("Handling sepulka viewing request: {}", request);
var state = dao.getBy(request.internalId());
return state.map(factory::newMessage).orElseThrow(RuntimeException::new);
return state.map(factory::newMessage)
.orElseThrow(() -> new RuntimeException("NotFoundException"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class SepulkaServiceImpl(

override fun view(request: ViewingRequest): ViewingResponse {
val state = dao.getBy(request.internalId)
return state?.let { factory.newMessage(it) } ?: throw RuntimeException()
return state?.let { factory.newMessage(it) } ?: throw RuntimeException("NotFoundException")
}
}
2 changes: 2 additions & 0 deletions tool/testing/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- Gear stack -->
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
Expand All @@ -6,6 +7,7 @@
</Console>
</Appenders>
<Loggers>
<Logger name="smecalculus.bezmen" level="error"/>
<Logger name="org.junit.jupiter.api" level="debug"/>
<Logger name="com.github.dockerjava" level="info"/>
<Root level="error">
Expand Down
3 changes: 2 additions & 1 deletion tool/testing/src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!-- Product stack -->
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1} - %msg%n</pattern>
</encoder>
</appender>
<logger name="smecalculus" level="error"/>
<logger name="smecalculus.bezmen" level="error"/>
<root level="error">
<appender-ref ref="CONSOLE"/>
</root>
Expand Down

0 comments on commit 23a1a80

Please sign in to comment.