From fed3d20ba3061d55260d18c739e657248c291067 Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Wed, 11 Jun 2014 18:07:22 +0000 Subject: [PATCH] refs #4938 Enhancing error handling in Sysdyn Model export. Now if an exception is thrown a visible notification is shown to user git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29612 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../sysdyn/ui/handlers/exports/ExportModelHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelHandler.java index 1d788840..01af5b2e 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelHandler.java @@ -44,6 +44,7 @@ import org.simantics.sysdyn.ui.Activator; import org.simantics.sysdyn.ui.utils.imports.ImportUtilsUI; import org.simantics.ui.SimanticsUI; import org.simantics.ui.utils.ResourceAdaptionUtils; +import org.simantics.utils.ui.ExceptionUtils; import org.simantics.utils.ui.workbench.WorkbenchUtils; /** @@ -133,7 +134,11 @@ public class ExportModelHandler extends AbstractHandler { try { TransferableGraphs.writeTransferableGraph(graph, "sysdynModel", 1, s,new File(fileName)); } catch (Exception e) { - e.printStackTrace(); + ExceptionUtils.logAndShowError("Model Export Failed", "Sysdyn model export failed, see exception for details", e); + + File modelFile = new File(fileName); + if (modelFile.exists()) + modelFile.delete(); } } }); -- 2.47.1