improved error messages in MissingShape.

This commit is contained in:
hneemann 2018-02-27 14:37:27 +01:00
parent 908aea3a9a
commit 504bb53585
4 changed files with 10 additions and 6 deletions

View File

@ -46,7 +46,7 @@ public class ElementTypeDescription {
Constructor<?> constructor = clazz.getConstructor(ElementAttributes.class); Constructor<?> constructor = clazz.getConstructor(ElementAttributes.class);
return (Element) constructor.newInstance(attributes); return (Element) constructor.newInstance(attributes);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(Lang.get("err_couldNotCreateElement_N", name), e);
} }
}, inputPins); }, inputPins);
} }

View File

@ -48,11 +48,13 @@ public class MissingShape implements Shape {
Throwable c = cause; Throwable c = cause;
int y = 4; int y = 4;
while (c != null) { while (c != null) {
y += style.getFontSize();
String message = c.getMessage(); String message = c.getMessage();
if (message != null && message.length() > 100) if (message != null && message.length() > 0) {
if (message.length() > 100)
message = message.substring(0, 100) + "..."; message = message.substring(0, 100) + "...";
y += style.getFontSize();
graphic.drawText(new Vector(4, y), new Vector(5, y), message, Orientation.LEFTTOP, style); graphic.drawText(new Vector(4, y), new Vector(5, y), message, Orientation.LEFTTOP, style);
}
c = c.getCause(); c = c.getCause();
} }
} }

View File

@ -748,7 +748,7 @@
Zur Analyse können Sie die Schaltung im Gatterschrittmodus ausführen.</string> Zur Analyse können Sie die Schaltung im Gatterschrittmodus ausführen.</string>
<string name="err_portIsInUse">Kann den Remote Port nicht öffnen! Läuft schon eine andere Instanz?</string> <string name="err_portIsInUse">Kann den Remote Port nicht öffnen! Läuft schon eine andere Instanz?</string>
<string name="err_selectorInputCountMismatch">Die Zahl der Eingänge passt nicht zur Bitbreite der Auswahlleitung.</string> <string name="err_selectorInputCountMismatch">Die Zahl der Eingänge passt nicht zur Bitbreite der Auswahlleitung.</string>
<string name="err_spitterDefSyntaxError">Fehler in der Definition {0} eines Splitters</string> <string name="err_spitterDefSyntaxError">Fehler in der Portdefinition "{0}" eines Splitters</string>
<string name="err_splitterBitsMismatch">Die Bitzahl am Spiltter passt nicht</string> <string name="err_splitterBitsMismatch">Die Bitzahl am Spiltter passt nicht</string>
<string name="err_splitterNotAllBitsDefined">Es sind nicht alle Eingangsbits definiert!</string> <string name="err_splitterNotAllBitsDefined">Es sind nicht alle Eingangsbits definiert!</string>
<string name="err_splitterNotUnambiguously">Es sind Eingangsbits mehrfach definiert!</string> <string name="err_splitterNotUnambiguously">Es sind Eingangsbits mehrfach definiert!</string>
@ -835,6 +835,7 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
Zyklen entstehen, wenn ein Ausgang eines Gatters auf einen der Eingänge des selben Gatters zurück geführt wird. Zyklen entstehen, wenn ein Ausgang eines Gatters auf einen der Eingänge des selben Gatters zurück geführt wird.
Die Verwendung von Schaltern, FETs oder Relais verursacht ebenfalls Zyklen.</string> Die Verwendung von Schaltern, FETs oder Relais verursacht ebenfalls Zyklen.</string>
<string name="err_monoflopRequiresOneClock">Wird ein Monoflop verwendet, muss es genau ein Taktelement geben!</string> <string name="err_monoflopRequiresOneClock">Wird ein Monoflop verwendet, muss es genau ein Taktelement geben!</string>
<string name="err_couldNotCreateElement_N">Konnte kein Element vom Typ "{0}" erzeugen!</string>
<string name="key_AddrBits">Adress-Bits</string><!-- ROM, RAMDualPort, RAMSinglePort, RAMSinglePortSel, EEPROM --> <string name="key_AddrBits">Adress-Bits</string><!-- ROM, RAMDualPort, RAMSinglePort, RAMSinglePortSel, EEPROM -->
<string name="key_AddrBits_tt">Anzahl der Adress-Bits, die verwendet werden.</string> <string name="key_AddrBits_tt">Anzahl der Adress-Bits, die verwendet werden.</string>

View File

@ -830,6 +830,7 @@ The names of the variables may not be unique.</string>
Cycles arise if an output of a gate is fed back to one of the inputs of the same gate. Cycles arise if an output of a gate is fed back to one of the inputs of the same gate.
The use of switches, FETs or relays also causes cycles.</string> The use of switches, FETs or relays also causes cycles.</string>
<string name="err_monoflopRequiresOneClock">If a monoflop is used, there must be exactly one clock component!</string> <string name="err_monoflopRequiresOneClock">If a monoflop is used, there must be exactly one clock component!</string>
<string name="err_couldNotCreateElement_N">Could not create a component of type {0}!</string>
<string name="key_AddrBits">Address Bits</string><!-- ROM, RAMDualPort, RAMSinglePort, RAMSinglePortSel, EEPROM --> <string name="key_AddrBits">Address Bits</string><!-- ROM, RAMDualPort, RAMSinglePort, RAMSinglePortSel, EEPROM -->
<string name="key_AddrBits_tt">Number of address bits used.</string> <string name="key_AddrBits_tt">Number of address bits used.</string>