Skip to content

Commit 63c9906

Browse files
committed
add basic exception-handling
1 parent 66c29cc commit 63c9906

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<modelVersion>4.0.0</modelVersion>
1212
<artifactId>websocket-server</artifactId>
13-
<version>1.0.5</version>
13+
<version>1.0.6</version>
1414
<name>WebsocketServer</name>
1515
<packaging>jar</packaging>
1616

src/main/java/info/unterrainer/websocketserver/WebsocketServer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public WebsocketServer(String keycloakHost, String keycloakRealm) {
3030
tokenManager = new OauthTokenManager(this.keycloakHost, this.realm);
3131
tokenManager.initPublicKey();
3232
wss = Javalin.create();
33+
wss.exception(Exception.class, (e, ctx) -> {
34+
log.error("Uncaught exception in Websocket-Server: {}", e);
35+
});
36+
wss.wsException(Exception.class, (e, ctx) -> {
37+
log.error("Uncaught websocket-exception in Websocket-Server: {}", e);
38+
});
3339
isOauthEnabled = true;
3440
} catch (Exception e) {
3541
// Exceptions will terminate a request later on, but should not terminate the

0 commit comments

Comments
 (0)