comparison Sources/OnStoredInstanceCallback.cpp @ 3:26762eb9d704

reporting of exceptions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 27 Mar 2020 11:56:30 +0100
parents 7ed502b17b8f
children fd58eb5749ed
comparison
equal deleted inserted replaced
2:df7b4f8a0437 3:26762eb9d704
51 PythonObject args2(lock, PyTuple_New(2)); 51 PythonObject args2(lock, PyTuple_New(2));
52 PyTuple_SetItem(args2.GetPyObject(), 0, pInst); 52 PyTuple_SetItem(args2.GetPyObject(), 0, pInst);
53 PyTuple_SetItem(args2.GetPyObject(), 1, PyUnicode_FromString(instanceId)); 53 PyTuple_SetItem(args2.GetPyObject(), 1, PyUnicode_FromString(instanceId));
54 54
55 PythonObject result(lock, PyObject_CallObject(storedInstanceCallback_, args2.GetPyObject())); 55 PythonObject result(lock, PyObject_CallObject(storedInstanceCallback_, args2.GetPyObject()));
56 return OrthancPluginErrorCode_Success; 56
57 std::string traceback;
58 if (lock.HasErrorOccurred(traceback))
59 {
60 OrthancPlugins::LogError("Error in the Python on-change callback, "
61 "traceback:\n" + traceback);
62 return OrthancPluginErrorCode_Plugin;
63 }
64 else
65 {
66 return OrthancPluginErrorCode_Success;
67 }
57 } 68 }
58 catch (OrthancPlugins::PluginException& e) 69 catch (OrthancPlugins::PluginException& e)
59 { 70 {
60 return e.GetErrorCode(); 71 return e.GetErrorCode();
61 } 72 }