mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 05:50:39 +00:00
Periphery Facades
This commit is contained in:
1 parent
b5d08b6203
commit
704c94aab4
85 files changed
+950
-774
No files matched your search
@@ -49,6 +49,21 @@ public final class IrisLogging {
|
||||
System.out.println("[Iris] " + message);
|
||||
}
|
||||
|
||||
public static void reportError(String context, Throwable error) {
|
||||
Throwable cause = error == null ? new IllegalStateException("Unknown Iris failure") : error;
|
||||
String message = context == null || context.isBlank() ? "Unhandled Iris failure." : context;
|
||||
|
||||
try {
|
||||
error(message);
|
||||
} catch (Throwable inner) {
|
||||
System.err.println("[Iris] " + message);
|
||||
inner.printStackTrace(System.err);
|
||||
}
|
||||
|
||||
reportError(cause);
|
||||
cause.printStackTrace(System.err);
|
||||
}
|
||||
|
||||
public static void reportError(Throwable error) {
|
||||
if (IrisPlatforms.isBound()) {
|
||||
IrisPlatforms.get().reportError(error);
|
||||
|
||||
@@ -40,6 +40,24 @@ public interface IrisPlatform {
|
||||
|
||||
File dataFolder();
|
||||
|
||||
default File dataFolder(String... path) {
|
||||
if (path == null || path.length == 0) {
|
||||
return dataFolder();
|
||||
}
|
||||
|
||||
File folder = new File(dataFolder(), String.join(File.separator, path));
|
||||
folder.mkdirs();
|
||||
return folder;
|
||||
}
|
||||
|
||||
default File dataFolderNoCreate(String... path) {
|
||||
if (path == null || path.length == 0) {
|
||||
return dataFolder();
|
||||
}
|
||||
|
||||
return new File(dataFolder(), String.join(File.separator, path));
|
||||
}
|
||||
|
||||
File dataFile(String... path);
|
||||
|
||||
File pluginJar();
|
||||
|
||||
Reference in new issue
Block a user