comparison Framework/Messages/IObservable.cpp @ 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 17660df24c36
children 5e164c629923
comparison
equal deleted inserted replaced
1099:66e21ef2d657 1100:08cc0d47aa94
19 **/ 19 **/
20 20
21 21
22 #include "IObservable.h" 22 #include "IObservable.h"
23 23
24 #include "../StoneException.h"
25
24 #include <Core/Logging.h> 26 #include <Core/Logging.h>
25 #include <Core/OrthancException.h>
26 27
27 #include <cassert> 28 #include <cassert>
28 29
29 namespace OrthancStone 30 namespace OrthancStone
30 { 31 {
73 if (observer) 74 if (observer)
74 { 75 {
75 if (receiver == NULL || // Are we broadcasting? 76 if (receiver == NULL || // Are we broadcasting?
76 observer.get() == receiver) // Not broadcasting, but this is the receiver 77 observer.get() == receiver) // Not broadcasting, but this is the receiver
77 { 78 {
78 (*it)->Apply(message); 79 try
80 {
81 (*it)->Apply(message);
82 }
83 catch (Orthanc::OrthancException& e)
84 {
85 LOG(ERROR) << "Exception on callable: " << e.What();
86 }
87 catch (StoneException& e)
88 {
89 LOG(ERROR) << "Exception on callable: " << e.What();
90 }
91 catch (...)
92 {
93 LOG(ERROR) << "Native exception on callable";
94 }
79 } 95 }
80 } 96 }
81 else 97 else
82 { 98 {
83 // TODO => Remove "it" from the list of callables => This 99 // TODO => Remove "it" from the list of callables => This