From 5cdb7814551b5bed38d2cf22484fb48fc645c8d9 Mon Sep 17 00:00:00 2001 From: rusEFI LLC Date: Thu, 13 Feb 2025 21:35:12 -0500 Subject: [PATCH] nicer errors? only:uaefi --- .../main/java/com/rusefi/autoupdate/Autoupdate.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/java_console/autoupdate/src/main/java/com/rusefi/autoupdate/Autoupdate.java b/java_console/autoupdate/src/main/java/com/rusefi/autoupdate/Autoupdate.java index 6f94c9b7a6..3f49fe9b24 100644 --- a/java_console/autoupdate/src/main/java/com/rusefi/autoupdate/Autoupdate.java +++ b/java_console/autoupdate/src/main/java/com/rusefi/autoupdate/Autoupdate.java @@ -182,6 +182,10 @@ public class Autoupdate { private static URLClassLoader prepareClassLoaderToStartConsole() { final URLClassLoader jarClassLoader; String consoleJarFileName = ConnectionAndMeta.getRusEfiConsoleJarName(); + if (!new File(consoleJarFileName).exists()) { + throw log.log(new RuntimeException("Looks like corrupted installation: " + consoleJarFileName + " not found")); + } + try { jarClassLoader = AutoupdateUtil.getClassLoaderByJar(consoleJarFileName); } catch (MalformedURLException e) { @@ -192,10 +196,11 @@ public class Autoupdate { // since we are overriding file we cannot just use static java classpath while launching try { hackProperties(jarClassLoader); - } catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException | + } catch (ClassNotFoundException e) { + throw log.log(new IllegalStateException("Class not found: " + e, e)); + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { - log.error("Failed to start", e); - throw new IllegalStateException("Failed to update properties", e); + throw log.log(new IllegalStateException("Failed to update properties: " + e, e)); } return jarClassLoader; }