improved error messages

This commit is contained in:
hneemann 2017-05-26 15:09:50 +02:00
parent 8af6a58408
commit 2b2ad24571
6 changed files with 12 additions and 6 deletions

View File

@ -1,5 +1,6 @@
package de.neemann.digital.testing;
import de.neemann.digital.lang.Lang;
import de.neemann.digital.testing.parser.LineEmitter;
import de.neemann.digital.testing.parser.Parser;
import de.neemann.digital.testing.parser.ParserException;
@ -66,7 +67,7 @@ public class TestData {
lines = tdp.getLines();
names = tdp.getNames();
} catch (ParserException | IOException e) {
throw new TestingDataException(e);
throw new TestingDataException(Lang.get("err_errorParsingTestdata"), e);
}
}
}

View File

@ -96,7 +96,7 @@ public class TestResult {
try {
lines.emitLines(new LineListenerResolveDontCare(values -> checkRow(model, values), inputs), new Context());
} catch (ParserException e) {
throw new TestingDataException(e);
throw new TestingDataException(Lang.get("err_errorParsingTestdata"), e);
} catch (RuntimeException e) {
if (allPassed) {
allPassed = false;

View File

@ -7,10 +7,11 @@ public class TestingDataException extends Exception {
/**
* creates a new instance
*
* @param cause the cause
* @param message the error message
* @param cause the cause
*/
public TestingDataException(Exception cause) {
super(cause);
public TestingDataException(String message, Exception cause) {
super(message, cause);
}
/**

View File

@ -61,7 +61,7 @@ public class ErrorMessage implements Runnable {
message.append(e.getClass().getSimpleName());
e = e.getCause();
if (e != null)
message.append("\ncaused by: ");
message.append("\n").append(Lang.get("msg_errCausedBy")).append(": ");
}
}

View File

@ -529,6 +529,7 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
<string name="err_MultiBitFlipFlopFound">Es sind keine Flipflops mit mehr als einem Bit erlaubt!</string>
<string name="err_invalidTransmissionGateState">Die Steuereingänge eines Transmission-Gates müssen invertiert beschaltet werden!</string>
<string name="err_nameUsedTwice_N">Signal {0} wurde mehrfach verwendet!</string>
<string name="err_errorParsingTestdata">Fehler beim Einlesen der Testdaten.</string>
<string name="key_AddrBits">Adress-Bits</string>
<string name="key_AddrBits_tt">Anzahl der Adress-Bits die verwendet werden.</string>
@ -865,6 +866,7 @@ Die Icons stammen aus dem Tango Desktop Project.</string>
<string name="btn_gifComplete">Fertig</string>
<string name="btn_gifComplete_tt">Die GIF-Datei wird abgeschlossen.</string>
<string name="msg_gifExport">GIF-Export</string>
<string name="msg_errCausedBy">verursacht durch</string>
<string name="ok">Ok</string>
<string name="rot_0"></string>

View File

@ -519,6 +519,7 @@ The names of the variables may not be unique.</string>
<string name="err_MultiBitFlipFlopFound">Flipflops with more then one bits are not allowed!</string>
<string name="err_invalidTransmissionGateState">The two control inputs of a transmission gate must be inverted!</string>
<string name="err_nameUsedTwice_N">Signal {0} is used twice!</string>
<string name="err_errorParsingTestdata">Error parsing the test data.</string>
<string name="key_AddrBits">Address Bits</string>
<string name="key_AddrBits_tt">Number of address bits used.</string>
@ -853,6 +854,7 @@ The icons are taken from the Tango Desktop Project.</string>
<string name="btn_gifComplete">Ready</string>
<string name="btn_gifComplete_tt">The GIF file is finalized and closed.</string>
<string name="msg_gifExport">GIF Export</string>
<string name="msg_errCausedBy">caused by</string>
<string name="ok">Ok</string>
<string name="rot_0"></string>