mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Corruption message fixes
This commit is contained in:
parent
e5a8745ce1
commit
8375fbd644
3 changed files with 23 additions and 10 deletions
|
@ -56,8 +56,8 @@ public class AppExtensionManager {
|
|||
ErrorEvent.fromThrowable(t).handle();
|
||||
});
|
||||
} catch (Throwable t) {
|
||||
throw new ExtensionException(
|
||||
"Service provider initialization failed. Is the installation data corrupt?", t);
|
||||
throw ExtensionException.corrupt(
|
||||
"Service provider initialization failed", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class AppExtensionManager {
|
|||
private void loadBaseExtension() {
|
||||
var baseModule = findAndParseExtension("base", ModuleLayer.boot());
|
||||
if (baseModule.isEmpty()) {
|
||||
throw new ExtensionException("Missing base module. Is the installation data corrupt?");
|
||||
throw ExtensionException.corrupt("Missing base module");
|
||||
}
|
||||
|
||||
baseLayer = baseModule.get().getModule().getLayer();
|
||||
|
@ -206,8 +206,8 @@ public class AppExtensionManager {
|
|||
var ext = getExtensionFromDir(layer, dir);
|
||||
if (ext.isEmpty()) {
|
||||
if (AppProperties.get().isFullVersion()) {
|
||||
throw new ExtensionException(
|
||||
"Unable to load extension from directory " + dir + ". Is the installation corrupted?");
|
||||
throw ExtensionException.corrupt(
|
||||
"Unable to load extension from directory " + dir);
|
||||
}
|
||||
} else {
|
||||
if (loadedExtensions.stream()
|
||||
|
|
|
@ -57,12 +57,12 @@ public interface DataStoreProvider {
|
|||
default void validate() {
|
||||
for (Class<?> storeClass : getStoreClasses()) {
|
||||
if (!JacksonizedValue.class.isAssignableFrom(storeClass)) {
|
||||
throw new ExtensionException(
|
||||
throw ExtensionException.corrupt(
|
||||
String.format("Store class %s is not a Jacksonized value", storeClass.getSimpleName()));
|
||||
}
|
||||
|
||||
if (getUsageCategory() == null) {
|
||||
throw new ExtensionException("Provider %s does not have the usage category".formatted(getId()));
|
||||
throw ExtensionException.corrupt("Provider %s does not have the usage category".formatted(getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package io.xpipe.app.ext;
|
||||
|
||||
import io.xpipe.core.util.XPipeInstallation;
|
||||
|
||||
public class ExtensionException extends RuntimeException {
|
||||
|
||||
public ExtensionException() {}
|
||||
|
||||
public ExtensionException(String message) {
|
||||
private ExtensionException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ExtensionException(String message, Throwable cause) {
|
||||
private ExtensionException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
|
@ -20,7 +22,18 @@ public class ExtensionException extends RuntimeException {
|
|||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
public static ExtensionException corrupt(String message, Throwable cause) {
|
||||
try {
|
||||
var loc = XPipeInstallation.getCurrentInstallationBasePath();
|
||||
var full = message + ".\n\n" + "Please check whether the XPipe installation data at " + loc + " is corrupted.";
|
||||
return new ExtensionException(full, cause);
|
||||
} catch (Throwable t) {
|
||||
var full = message + ".\n\n" + "Please check whether the XPipe installation data is corrupted.";
|
||||
return new ExtensionException(full, cause);
|
||||
}
|
||||
}
|
||||
|
||||
public static ExtensionException corrupt(String message) {
|
||||
return new ExtensionException(message + ". Is the installation data corrupt?");
|
||||
return corrupt(message, null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue