This commit is contained in:
crschnick 2023-08-10 15:40:17 +00:00
parent 33ca8cca9c
commit 8b695c7ba2
2 changed files with 7 additions and 3 deletions

View file

@ -19,6 +19,6 @@ public class LaunchExchangeImpl extends LaunchExchange
return Response.builder().command(List.of(split.toStrings())).build();
}
throw new IllegalArgumentException("Not launchable");
throw new IllegalArgumentException(store.getName() + " is not launchable");
}
}

View file

@ -64,15 +64,19 @@ public interface MessageExchangeImpl<RQ extends RequestMessage, RS extends Respo
return store.get();
}
default DataStoreEntry getStoreEntryById(@NonNull DataStoreId id, boolean acceptDisabled) throws ClientException {
default DataStoreEntry getStoreEntryById(@NonNull DataStoreId id, boolean acceptUnusable) throws ClientException {
var store = DataStorage.get().getStoreEntryIfPresent(id);
if (store.isEmpty()) {
throw new ClientException("No store with id " + id + " was found");
}
if (store.get().isDisabled() && !acceptDisabled) {
if (store.get().isDisabled() && !acceptUnusable) {
throw new ClientException(
String.format("Store %s is disabled", store.get().getName()));
}
if (!store.get().getState().isUsable() && !acceptUnusable) {
throw new ClientException(
String.format("Store %s is not completely configured", store.get().getName()));
}
return store.get();
}