better? different? exception handler
This commit is contained in:
parent
147ac9dc02
commit
eec40d28a2
|
@ -1,6 +1,7 @@
|
|||
package com.rusefi.io;
|
||||
|
||||
import com.devexperts.logging.Logging;
|
||||
import com.rusefi.Listener;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.util.IoUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -99,6 +100,8 @@ public class CommandQueue {
|
|||
}
|
||||
}
|
||||
|
||||
public static Listener<Throwable> ERROR_HANDLER = parameter -> IoUtils.exit("CommandQueue error: " + parameter, -2);
|
||||
|
||||
public CommandQueue(LinkManager linkManager) {
|
||||
this.linkManager = linkManager;
|
||||
runnable = new Runnable() {
|
||||
|
@ -110,7 +113,8 @@ public class CommandQueue {
|
|||
try {
|
||||
sendPendingCommand();
|
||||
} catch (Throwable e) {
|
||||
IoUtils.exit("CommandQueue error" + e, -2);
|
||||
log.error("Major connectivity error", e);
|
||||
ERROR_HANDLER.onResult(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.devexperts.logging.Logging;
|
|||
import com.rusefi.autodetect.PortDetector;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocolLogger;
|
||||
import com.rusefi.core.MessagesCentral;
|
||||
import com.rusefi.io.CommandQueue;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.io.serial.BaudRateHolder;
|
||||
import com.rusefi.maintenance.FirmwareFlasher;
|
||||
|
@ -62,6 +63,10 @@ public class ConsoleUI {
|
|||
}
|
||||
|
||||
public ConsoleUI(String port) {
|
||||
CommandQueue.ERROR_HANDLER = e -> SwingUtilities.invokeLater(() -> {
|
||||
throw new IllegalStateException("Connectivity error", e);
|
||||
});
|
||||
|
||||
log.info("init...");
|
||||
tabbedPane = new TabbedPanel(uiContext);
|
||||
this.port = port;
|
||||
|
|
Loading…
Reference in New Issue