From bca3622d556288a562cc86a2abe0db4031f1ac21 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sun, 8 Nov 2020 13:02:07 +0100 Subject: [PATCH] Improved error when emulator cannot be found. Closes #506 --- src/main/java/dk/camelot64/kickc/KickC.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/dk/camelot64/kickc/KickC.java b/src/main/java/dk/camelot64/kickc/KickC.java index 175eab9e4..f4d7f3655 100644 --- a/src/main/java/dk/camelot64/kickc/KickC.java +++ b/src/main/java/dk/camelot64/kickc/KickC.java @@ -463,12 +463,14 @@ public class KickC implements Callable { CharToPetsciiConverter.setCurrentEncoding("screencode_mixed"); kasmResult = KickAssembler65CE02.main2(assembleCommand.toArray(new String[0])); } catch(Throwable e) { - throw new CompileError("KickAssembling file failed! ", e); + System.err.println("KickAssembling file failed! "+e.getMessage()); + return COMPILE_ERROR; } finally { System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out))); } if(kasmResult != 0) { - throw new CompileError("KickAssembling file failed! " + kasmLogOutputStream.toString()); + System.err.println("KickAssembling file failed! " + kasmLogOutputStream.toString()); + return COMPILE_ERROR; } } @@ -491,8 +493,13 @@ public class KickC implements Callable { if(verbose) { System.out.println("Executing command: " + executeCommand); } - Process process = Runtime.getRuntime().exec(executeCommand); - process.waitFor(); + try { + Process process = Runtime.getRuntime().exec(executeCommand); + process.waitFor(); + } catch(Throwable e) { + System.err.println("Executing emulator failed! "+e.getMessage()); + return COMPILE_ERROR; + } } }