[Minor] Don't log exception for session validation

This commit is contained in:
Robert von Burg 2024-01-11 16:24:31 +01:00
parent 373235f5e2
commit bf01876f7c
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
1 changed files with 6 additions and 1 deletions

View File

@ -24,8 +24,10 @@ import jakarta.ws.rs.*;
import jakarta.ws.rs.core.*;
import jakarta.ws.rs.core.Response.Status;
import li.strolch.exception.StrolchException;
import li.strolch.exception.StrolchNotAuthenticatedException;
import li.strolch.privilege.base.AccessDeniedException;
import li.strolch.privilege.base.InvalidCredentialsException;
import li.strolch.privilege.base.NotAuthenticatedException;
import li.strolch.privilege.base.PrivilegeException;
import li.strolch.privilege.model.Certificate;
import li.strolch.privilege.model.Privilege;
@ -193,7 +195,10 @@ public class AuthenticationResource {
}
private static Response handleSessionException(String context, Exception e) {
logger.error(e.getMessage(), e);
if (e instanceof StrolchNotAuthenticatedException || e instanceof NotAuthenticatedException)
logger.error("Session exception: " + e.getMessage());
else
logger.error(e.getMessage(), e);
Throwable rootCause = getRootCause(e);
String msg = MessageFormat.format("{0}: {1}", context, rootCause);
return evaluateResponseByCause(e, msg);