Skip to content
Snippets Groups Projects
Commit 1398231d authored by Daniel Plagge's avatar Daniel Plagge
Browse files

Converting RuntimeExceptions to TranslationFailedExceptions,

because the latter failed silently on export to classical ProB
parent 891f45b3
No related branches found
No related tags found
Loading
...@@ -33,7 +33,8 @@ public class TranslatorFactory { ...@@ -33,7 +33,8 @@ public class TranslatorFactory {
*/ */
public static void translate(final IEventBRoot root, public static void translate(final IEventBRoot root,
final IPrologTermOutput pto) throws TranslationFailedException { final IPrologTermOutput pto) throws TranslationFailedException {
final String componentName = root.getComponentName();
try {
if (root instanceof IMachineRoot) { if (root instanceof IMachineRoot) {
final ISCMachineRoot scRoot = ((IMachineRoot) root) final ISCMachineRoot scRoot = ((IMachineRoot) root)
.getSCMachineRoot(); .getSCMachineRoot();
...@@ -44,10 +45,14 @@ public class TranslatorFactory { ...@@ -44,10 +45,14 @@ public class TranslatorFactory {
.getSCContextRoot(); .getSCContextRoot();
EventBContextTranslator.create(scRoot, pto); EventBContextTranslator.create(scRoot, pto);
} else { } else {
throw new TranslationFailedException(root.getComponentName(), throw new TranslationFailedException(componentName,
"Cannot translate anything else than IMachineRoot or IContextRoot. Type was: " "Cannot translate anything else than IMachineRoot or IContextRoot. Type was: "
+ root.getClass()); + root.getClass());
} }
} catch (RuntimeException e) {
throw new TranslationFailedException(componentName,
"A runtime exception occurred: " + e.getMessage(), e);
}
} }
public static void translate(final IEventBRoot root, public static void translate(final IEventBRoot root,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment