fixed exception

This commit is contained in:
Luca Frosini 2022-03-30 15:04:09 +02:00
parent dab0deea20
commit 2ab160275c
1 changed files with 3 additions and 3 deletions

View File

@ -39,7 +39,7 @@ public class SecretManager {
public synchronized void startSession(Secret secret) throws Exception { public synchronized void startSession(Secret secret) throws Exception {
if (currentSecretHolder != initialSecretHolder) { if (currentSecretHolder != initialSecretHolder) {
throw new Exception("You are already in a session. You must terminate the session first."); throw new RuntimeException("You are already in a session. You must terminate the session first.");
} }
initialSecretHolder.reset(); initialSecretHolder.reset();
currentSecretHolder = new SecretHolder(secret); currentSecretHolder = new SecretHolder(secret);
@ -48,7 +48,7 @@ public class SecretManager {
public synchronized void startSession(Collection<Secret> secrets) throws Exception { public synchronized void startSession(Collection<Secret> secrets) throws Exception {
if (currentSecretHolder != initialSecretHolder) { if (currentSecretHolder != initialSecretHolder) {
throw new Exception("You are already in a session. You must terminate the session first."); throw new RuntimeException("You are already in a session. You must terminate the session first.");
} }
initialSecretHolder.reset(); initialSecretHolder.reset();
currentSecretHolder = new SecretHolder(secrets); currentSecretHolder = new SecretHolder(secrets);
@ -57,7 +57,7 @@ public class SecretManager {
public synchronized void startSession(SecretHolder secretHolder) throws Exception { public synchronized void startSession(SecretHolder secretHolder) throws Exception {
if (currentSecretHolder != initialSecretHolder) { if (currentSecretHolder != initialSecretHolder) {
throw new Exception("You are already in a session. You must terminate the session first."); throw new RuntimeException("You are already in a session. You must terminate the session first.");
} }
initialSecretHolder.reset(); initialSecretHolder.reset();
currentSecretHolder = secretHolder; currentSecretHolder = secretHolder;