mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 16:28:56 +00:00
[XtextGenerator] improve error reporting
Signed-off-by: Moritz Eysholdt <moritz.eysholdt@typefox.io>
This commit is contained in:
parent
607e2cd031
commit
914880e1d7
2 changed files with 10 additions and 4 deletions
|
@ -202,10 +202,11 @@ class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implements IXte
|
|||
|
||||
override add(Diagnostic diagnostic) {
|
||||
if (diagnostic.severity == Diagnostic.ERROR) {
|
||||
val grammarName = "Validation Error in " + grammar.name + ": "
|
||||
if (diagnostic.exception == null)
|
||||
throw new IllegalStateException(diagnostic.message)
|
||||
throw new IllegalStateException(grammarName + diagnostic.message)
|
||||
else
|
||||
throw new IllegalStateException(diagnostic.message, diagnostic.exception)
|
||||
throw new IllegalStateException(grammarName + diagnostic.message, diagnostic.exception)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -331,15 +331,20 @@ public class XtextGeneratorLanguage extends CompositeGeneratorFragment2 implemen
|
|||
int _severity = diagnostic.getSeverity();
|
||||
boolean _equals = (_severity == Diagnostic.ERROR);
|
||||
if (_equals) {
|
||||
String _name = grammar.getName();
|
||||
String _plus = ("Validation Error in " + _name);
|
||||
final String grammarName = (_plus + ": ");
|
||||
Throwable _exception = diagnostic.getException();
|
||||
boolean _equals_1 = Objects.equal(_exception, null);
|
||||
if (_equals_1) {
|
||||
String _message = diagnostic.getMessage();
|
||||
throw new IllegalStateException(_message);
|
||||
String _plus_1 = (grammarName + _message);
|
||||
throw new IllegalStateException(_plus_1);
|
||||
} else {
|
||||
String _message_1 = diagnostic.getMessage();
|
||||
String _plus_2 = (grammarName + _message_1);
|
||||
Throwable _exception_1 = diagnostic.getException();
|
||||
throw new IllegalStateException(_message_1, _exception_1);
|
||||
throw new IllegalStateException(_plus_2, _exception_1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue