diff options
author | jonmv <venstad@gmail.com> | 2023-09-26 10:01:33 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2023-09-26 10:01:33 +0200 |
commit | b3eaf33c686d78e66886c27260747d14fd6cf908 (patch) | |
tree | 3449dac301cdad247be607559fe2b222e2db06e6 /configserver | |
parent | 9340f19d1adb90c0713d85424d6d616869bf4e86 (diff) |
Log tenant name when session not found
Diffstat (limited to 'configserver')
3 files changed, 6 insertions, 6 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java index 9533f04107d..63faf806e9c 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java @@ -1030,21 +1030,21 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye private Session validateThatLocalSessionIsNotActive(Tenant tenant, long sessionId) { Session session = getLocalSession(tenant, sessionId); if (Session.Status.ACTIVATE.equals(session.getStatus())) { - throw new IllegalArgumentException("Session is active: " + sessionId); + throw new IllegalArgumentException("Session " + sessionId + " for '" + tenant.getName() + "' is active"); } return session; } private Session getLocalSession(Tenant tenant, long sessionId) { Session session = tenant.getSessionRepository().getLocalSession(sessionId); - if (session == null) throw new NotFoundException("Session " + sessionId + " was not found"); + if (session == null) throw new NotFoundException("Local session " + sessionId + " for '" + tenant.getName() + "' was not found"); return session; } private RemoteSession getRemoteSession(Tenant tenant, long sessionId) { RemoteSession session = tenant.getSessionRepository().getRemoteSession(sessionId); - if (session == null) throw new NotFoundException("Session " + sessionId + " was not found"); + if (session == null) throw new NotFoundException("Remote session " + sessionId + " for '" + tenant.getName() + "' was not found"); return session; } diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java index a704599c6d4..62a6fa31c49 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java @@ -606,7 +606,7 @@ public class ApplicationRepositoryTest { long sessionId = result.sessionId(); exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage("Session is active: 2"); + exceptionRule.expectMessage("Session 2 for 'test1' is active"); applicationRepository.prepare(sessionId, prepareParams()); exceptionRule.expect(IllegalArgumentException.class); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java index 765523177a9..88aed6b058c 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/SessionPrepareHandlerTest.java @@ -92,7 +92,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest { public void require_error_when_session_id_does_not_exist() throws Exception { // No session with this id exists HttpResponse response = request(HttpRequest.Method.PUT, 9999L); - assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "Session 9999 was not found"); + assertHttpStatusCodeErrorCodeAndMessage(response, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, "Local session 9999 for 'test' was not found"); } @Test @@ -180,7 +180,7 @@ public class SessionPrepareHandlerTest extends SessionHandlerTest { HttpResponse getResponse = request(HttpRequest.Method.GET, 9999L); assertHttpStatusCodeErrorCodeAndMessage(getResponse, NOT_FOUND, HttpErrorResponse.ErrorCode.NOT_FOUND, - "Session 9999 was not found"); + "Remote session 9999 for 'test' was not found"); } @Test |