mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 01:04:29 +00:00
Report swallowed failures
- Add art.arcane.iris.spi.CapabilityProbe so an absent optional API is recorded at debug with the failure class and message instead of a bare ignored catch - Route runtime day-time reads, clock pushes and the noon time lock through IrisLogging.reportError with the world name and the full trace - Report a level storage access that will not close, so a retained world session lock names its cause - Report a failed iris.json rewrite with the file path instead of dropping the IOException - Report Iris world registry and dimension read failures during Multiverse reconciliation instead of logging one debug line - Report a failed pack compatibility summary and a failed vanilla-slot capture with their traces - Report a superseded generation semantics shard that cannot be deleted, once, with its path - Restore the interrupt flag when the global cache trimmer join is interrupted - Replace ValueWithDiagnostics with CheckResult so a startup check carries the runtime lock reason it raises - Give every startup check an explicit advisory or critical severity and lock the runtime on any Danger result, replacing the catch that recognised the injection check by id - Lock the runtime when general.disableNMS holds a no-op binding or the NMS binding is unbound, instead of marking the runtime ready - Match incompatible plugin names against every registered plugin without regard to case - Name the JVM maximum heap in the memory check output - Print the lock reason and what it blocks when Iris enables into a locked runtime - Carry the per-check safeguard modes and diagnostic lines in /iris debugdump
This commit is contained in:
1 parent
45b9ff8e11
commit
f83cf71b11
34 files changed
+1267
-306
No files matched your search
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.spi;
|
||||
|
||||
/**
|
||||
* Runs a lookup whose failure means "this optional API, plugin or server capability is not here" and answers
|
||||
* with a fallback instead of throwing.
|
||||
* <p>
|
||||
* This is the only sanctioned form of a quiet catch in Iris. A probe states the capability it was looking
|
||||
* for, and a miss is recorded at {@link LogLevel#DEBUG} with the failure's class and message, so an operator
|
||||
* running with debug on can tell a genuinely absent API apart from one that broke while being reached. Every
|
||||
* other catch - world lifecycle, world replacement, runtime control, safeguard, service enable and disable,
|
||||
* generation - reports through {@link IrisLogging#reportError(String, Throwable)} with the full trace.
|
||||
* <p>
|
||||
* Internal to Iris; not a published integration surface.
|
||||
*/
|
||||
public final class CapabilityProbe {
|
||||
private CapabilityProbe() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves {@code probe}, or returns {@code unavailable} when it throws.
|
||||
*
|
||||
* @param capability what was being looked for, for the debug record - for example
|
||||
* {@code "world#getChunkAtAsync"}
|
||||
* @param probe the lookup; any {@link Throwable} it raises means the capability is absent
|
||||
* @param unavailable the value that stands for an absent capability
|
||||
*/
|
||||
public static <T> T attempt(String capability, Probe<T> probe, T unavailable) {
|
||||
try {
|
||||
return probe.resolve();
|
||||
} catch (Throwable failure) {
|
||||
recordUnavailable(capability, failure);
|
||||
return unavailable;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs {@code attempt} and reports whether it completed, for a probe whose only result is that it worked.
|
||||
*/
|
||||
public static boolean succeeds(String capability, Attempt attempt) {
|
||||
try {
|
||||
attempt.run();
|
||||
return true;
|
||||
} catch (Throwable failure) {
|
||||
recordUnavailable(capability, failure);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void recordUnavailable(String capability, Throwable failure) {
|
||||
if (failure instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
||||
String name = capability == null || capability.isBlank() ? "unnamed" : capability;
|
||||
String message = failure.getMessage();
|
||||
IrisLogging.debug("Capability probe \"" + name + "\" is unavailable: "
|
||||
+ failure.getClass().getName()
|
||||
+ (message == null ? "" : ": " + message));
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Probe<T> {
|
||||
T resolve() throws Throwable;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Attempt {
|
||||
void run() throws Throwable;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user