comparison Sources/PythonLock.cpp @ 75:cbfc72a53970

refactoring calls to PythonLock::RaiseException()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Aug 2021 16:59:59 +0200
parents 32de70a1e4c7
children e7ff5efb100d
comparison
equal deleted inserted replaced
73:da73be4b361b 75:cbfc72a53970
470 470
471 Py_Finalize(); 471 Py_Finalize();
472 } 472 }
473 473
474 474
475 void PythonLock::RaiseException(PyObject* module, 475 void PythonLock::RaiseException(OrthancPluginErrorCode code)
476 OrthancPluginErrorCode code)
477 { 476 {
478 if (code != OrthancPluginErrorCode_Success) 477 if (code != OrthancPluginErrorCode_Success)
479 { 478 {
479 PyErr_SetString(PyExc_ValueError, "Internal error");
480
481 #if 0
480 const char* message = OrthancPluginGetErrorDescription(OrthancPlugins::GetGlobalContext(), code); 482 const char* message = OrthancPluginGetErrorDescription(OrthancPlugins::GetGlobalContext(), code);
481 483
482 struct module_state *state = GETSTATE(module); 484 struct module_state *state = GETSTATE(module);
483 if (state->exceptionClass_ == NULL) 485 if (state->exceptionClass_ == NULL)
484 { 486 {
486 } 488 }
487 else 489 else
488 { 490 {
489 PyErr_SetString(state->exceptionClass_, message); 491 PyErr_SetString(state->exceptionClass_, message);
490 } 492 }
493 #endif
491 } 494 }
492 } 495 }
493 496
494 497
495 void PythonLock::LogCall(const std::string& message) 498 void PythonLock::LogCall(const std::string& message)