[Minor] Don't log stack trace if auth token is invalid

This commit is contained in:
Robert von Burg 2020-02-26 09:25:00 +01:00
parent a15318ba55
commit 9f4082ebf0
1 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import li.strolch.agent.api.ComponentContainer;
import li.strolch.agent.api.ObserverHandler;
import li.strolch.exception.StrolchNotAuthenticatedException;
import li.strolch.model.Tags;
import li.strolch.privilege.model.Certificate;
import li.strolch.rest.StrolchSessionHandler;
@ -162,7 +163,10 @@ public class WebSocketClient implements MessageHandler.Whole<String> {
logger.info("User " + this.certificate.getUsername() + " authenticated on WebSocket with remote IP "
+ this.remoteIp);
} catch (Exception e) {
logger.error("Failed to authenticate user " + username, e);
if (e instanceof StrolchNotAuthenticatedException)
logger.error("Failed to authenticate user " + username + ": " + e.getMessage());
else
logger.error("Failed to authenticate user " + username, e);
close(CloseReason.CloseCodes.UNEXPECTED_CONDITION, "Invalid authentication");
return;
}