Extract pack build failure handling
This commit is contained in:
@@ -207,20 +207,17 @@ public final class PackRuntime implements AutoCloseable {
|
||||
server.execute(() -> publishPack(source, next, pack));
|
||||
} catch (Exception e) {
|
||||
AstraPacks.LOG.error("Pack build/publication failed; active pack retained", e);
|
||||
server.execute(
|
||||
() -> {
|
||||
building = false;
|
||||
if (!closed) {
|
||||
source.sendFailure(
|
||||
Component.literal(
|
||||
"AstraPacks: "
|
||||
+ e.getMessage()
|
||||
+ " Рабочий пак сохранён."));
|
||||
}
|
||||
});
|
||||
server.execute(() -> failBuild(source, e));
|
||||
}
|
||||
}
|
||||
|
||||
private void failBuild(CommandSourceStack source, Exception error) {
|
||||
building = false;
|
||||
if (closed) return;
|
||||
String message = "AstraPacks: " + error.getMessage() + " Рабочий пак сохранён.";
|
||||
source.sendFailure(Component.literal(message));
|
||||
}
|
||||
|
||||
private void publishPack(CommandSourceStack source, PackConfig next, PackBuilder.Pack pack) {
|
||||
building = false;
|
||||
if (closed) {
|
||||
|
||||
Reference in New Issue
Block a user