From 9b92fb149a17ec34030078675deba55f8c52ae8e Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 21 Jan 2019 09:42:06 +0100 Subject: [PATCH] Exception management --- src/Launcher_SWIG/Launcher.i | 14 ++++++++++++++ src/Launcher_SWIG/test.py | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Launcher_SWIG/Launcher.i b/src/Launcher_SWIG/Launcher.i index 6ef6806f7..c7b871688 100644 --- a/src/Launcher_SWIG/Launcher.i +++ b/src/Launcher_SWIG/Launcher.i @@ -29,6 +29,20 @@ %} %include std_string.i +%exception +{ + try { + $function + } + catch(LauncherException& e) + { + SWIG_exception_fail(SWIG_RuntimeError,e.msg.c_str()); + } + catch (...) + { + SWIG_exception_fail(SWIG_UnknownError, "Unknown"); + } +} struct resourceParams { diff --git a/src/Launcher_SWIG/test.py b/src/Launcher_SWIG/test.py index d4af48e19..1b87a1947 100644 --- a/src/Launcher_SWIG/test.py +++ b/src/Launcher_SWIG/test.py @@ -36,6 +36,7 @@ l = pyla.Launcher_cpp() res = pyla.ResourcesManager_cpp("/home/H87074/salome/V9_DEV/appli_V9_2_0/CatalogResources.xml") l.SetResourcesManager(res) l.createJob(jyf) -nb=jyf.getNumber() +"""nb=jyf.getNumber() l.launchJob(nb) l.getJobState(nb) +l.getJobResults(nb,jyf.getLocalDirectory())""" -- 2.39.2