Mercurial > hg > orthanc-stone
changeset 1100:08cc0d47aa94 broker
exception handling in IObservable::EmitMessage()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Oct 2019 18:06:30 +0200 |
parents | 66e21ef2d657 |
children | a9d10e54c536 |
files | Framework/Messages/IObservable.cpp |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Messages/IObservable.cpp Fri Oct 25 14:58:06 2019 +0200 +++ b/Framework/Messages/IObservable.cpp Fri Oct 25 18:06:30 2019 +0200 @@ -21,8 +21,9 @@ #include "IObservable.h" +#include "../StoneException.h" + #include <Core/Logging.h> -#include <Core/OrthancException.h> #include <cassert> @@ -75,7 +76,22 @@ if (receiver == NULL || // Are we broadcasting? observer.get() == receiver) // Not broadcasting, but this is the receiver { - (*it)->Apply(message); + try + { + (*it)->Apply(message); + } + catch (Orthanc::OrthancException& e) + { + LOG(ERROR) << "Exception on callable: " << e.What(); + } + catch (StoneException& e) + { + LOG(ERROR) << "Exception on callable: " << e.What(); + } + catch (...) + { + LOG(ERROR) << "Native exception on callable"; + } } } else