comparison OrthancServer/ServerContext.cpp @ 2134:ddc75c6c712d

Avoid hard crash if not enough memory
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Nov 2016 12:04:09 +0100
parents 9329ba17a069
children cadfe0a2a393
comparison
equal deleted inserted replaced
2133:15ae532af70e 2134:ddc75c6c712d
84 for (ServerListeners::iterator it = that->listeners_.begin(); 84 for (ServerListeners::iterator it = that->listeners_.begin();
85 it != that->listeners_.end(); ++it) 85 it != that->listeners_.end(); ++it)
86 { 86 {
87 try 87 try
88 { 88 {
89 it->GetListener().SignalChange(change); 89 try
90 {
91 it->GetListener().SignalChange(change);
92 }
93 catch (std::bad_alloc&)
94 {
95 LOG(ERROR) << "Not enough memory while signaling a change";
96 }
97 catch (...)
98 {
99 throw OrthancException(ErrorCode_InternalError);
100 }
90 } 101 }
91 catch (OrthancException& e) 102 catch (OrthancException& e)
92 { 103 {
93 LOG(ERROR) << "Error in the " << it->GetDescription() 104 LOG(ERROR) << "Error in the " << it->GetDescription()
94 << " callback while signaling a change: " << e.What(); 105 << " callback while signaling a change: " << e.What();