Base: Allow to also throw exception by given Python type
This commit is contained in:
@@ -52,11 +52,16 @@ void ExceptionFactory::raiseException(PyObject* pydict) const
|
||||
if (edict.hasKey("sclassname")) {
|
||||
classname = static_cast<std::string>(Py::String(edict.getItem("sclassname")));
|
||||
|
||||
std::map<const std::string, AbstractProducer*>::const_iterator pProd;
|
||||
|
||||
pProd = _mpcProducers.find(classname);
|
||||
auto pProd = _mpcProducers.find(classname);
|
||||
if (pProd != _mpcProducers.end()) {
|
||||
static_cast<AbstractExceptionProducer*>(pProd->second)->raiseException(pydict);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExceptionFactory::raiseExceptionByType(const PyExceptionData& data) const
|
||||
{
|
||||
for (const auto& it : _mpcProducers) {
|
||||
static_cast<AbstractExceptionProducer*>(it.second)->raiseExceptionByType(data); // NOLINT
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user