From 9178d36168111e53060327114197079265b68d62 Mon Sep 17 00:00:00 2001 From: Overlord Date: Mon, 5 Oct 2026 19:46:18 +0200 Subject: [PATCH] Refine exception messages in `AssetLoadingHooks` and `RolesHooks` for clarity during hook registration and transaction handling. --- .../zomboidforge/compat/b42/hooks/AssetLoadingHooks.java | 4 ++-- .../zomboidforge/compat/b42/hooks/RolesHooks.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compat/b42/runtime/src/main/java/dev/overlord/zomboidforge/compat/b42/hooks/AssetLoadingHooks.java b/compat/b42/runtime/src/main/java/dev/overlord/zomboidforge/compat/b42/hooks/AssetLoadingHooks.java index 529cc48..4f6e4d7 100644 --- a/compat/b42/runtime/src/main/java/dev/overlord/zomboidforge/compat/b42/hooks/AssetLoadingHooks.java +++ b/compat/b42/runtime/src/main/java/dev/overlord/zomboidforge/compat/b42/hooks/AssetLoadingHooks.java @@ -44,7 +44,7 @@ public final class AssetLoadingHooks executor = MethodHandles.privateLookupIn(FileSystemImpl.class, MethodHandles.lookup()) .findVarHandle(FileSystemImpl.class, "executor", ExecutorService.class); } - catch (ReflectiveOperationException e) { System.out.println("[ZomboidForge] Asset loading keeps its loader threads: 'FileSystemImpl.executor' not found: " + e); } + catch (ReflectiveOperationException e) { System.out.println("[ZomboidForge] Unable to register hook 'AssetLoadingHooks.updateAsyncTransactions': 'FileSystemImpl.executor' not found: " + e); } EXECUTOR = executor; } @@ -79,7 +79,7 @@ public final class AssetLoadingHooks // A fixed pool: maximum first, the core size may not exceed it. if (executor instanceof ThreadPoolExecutor pool && pool.getMaximumPoolSize() < threads) { - System.out.println("[ZomboidForge] Asset loading: " + threads + " loader threads instead of " + pool.getMaximumPoolSize() + "."); + System.out.println("[ZomboidForge] Loader threads: " + pool.getMaximumPoolSize() + " -> " + threads + "."); pool.setMaximumPoolSize(threads); pool.setCorePoolSize(threads); } diff --git a/compat/b42/runtime/src/main/java/dev/overlord/zomboidforge/compat/b42/hooks/RolesHooks.java b/compat/b42/runtime/src/main/java/dev/overlord/zomboidforge/compat/b42/hooks/RolesHooks.java index 7909078..a4b6c31 100644 --- a/compat/b42/runtime/src/main/java/dev/overlord/zomboidforge/compat/b42/hooks/RolesHooks.java +++ b/compat/b42/runtime/src/main/java/dev/overlord/zomboidforge/compat/b42/hooks/RolesHooks.java @@ -33,7 +33,7 @@ public final class RolesHooks connection = MethodHandles.privateLookupIn(ServerWorldDatabase.class, MethodHandles.lookup()) .findVarHandle(ServerWorldDatabase.class, "conn", Connection.class); } - catch (ReflectiveOperationException e) { System.out.println("[ZomboidForge] Roles are saved without a transaction: 'ServerWorldDatabase.conn' not found: " + e); } + catch (ReflectiveOperationException e) { System.out.println("[ZomboidForge] Unable to register hook 'RolesHooks.beginSave': 'ServerWorldDatabase.conn' not found: " + e); } CONNECTION = connection; } @@ -58,7 +58,7 @@ public final class RolesHooks connection.setAutoCommit(false); RolesHooks.transaction = connection; } - catch (SQLException e) { System.out.println("[ZomboidForge] Roles are saved without a transaction: " + e); } + catch (SQLException e) { System.out.println("[ZomboidForge] Unable to begin the roles transaction: " + e); } } /** @@ -72,11 +72,11 @@ public final class RolesHooks if (connection == null) return; try { connection.commit(); } - catch (SQLException e) { System.out.println("[ZomboidForge] Committing the saved roles failed: " + e); } + catch (SQLException e) { System.out.println("[ZomboidForge] Unable to commit the roles transaction: " + e); } finally { try { connection.setAutoCommit(true); } - catch (SQLException e) { System.out.println("[ZomboidForge] Switching the database back to autocommit failed: " + e); } + catch (SQLException e) { System.out.println("[ZomboidForge] Unable to restore autocommit: " + e); } } } }