From 5c82d73eba2fd31f17b965aef9ce90d1195127a2 Mon Sep 17 00:00:00 2001 From: Utz-Uwe Haus <uhaus@cray.com> Date: Wed, 2 Nov 2022 08:32:44 +0100 Subject: [PATCH] Implement mstro_status -> Exception typemap --- scripting/maestro-py.i | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripting/maestro-py.i b/scripting/maestro-py.i index a2187af4..8e5c2c9e 100644 --- a/scripting/maestro-py.i +++ b/scripting/maestro-py.i @@ -2,6 +2,16 @@ %include "typemaps.i" %include "stdint.i" %include "cpointer.i" +%include "exception.i" + +/* handling mstro_status return codes: suppress unless an error needs to be indicated. In that case: throw exeption */ +%typemap(out) mstro_status { + if(MSTRO_OK!=$1) { + SWIG_exception(SWIG_RuntimeError, mstro_status_description($1)); + } else { + $result = SWIG_Py_Void(); + } +} %{ #define SWIG_FILE_WITH_INIT -- GitLab