comparison OrthancStone/Sources/Loaders/LoaderStateMachine.cpp @ 1831:a03260db8835

Added SetCallerName to IOracleCommand to ease debugging and logging
author Benjamin Golinvaux <bgo@osimis.io>
date Thu, 03 Jun 2021 09:14:07 +0200
parents 9ac2a65d4172
children 3889ae96d2e9
comparison
equal deleted inserted replaced
1830:fa38043b14b0 1831:a03260db8835
132 } 132 }
133 133
134 134
135 void LoaderStateMachine::HandleExceptionMessage(const OracleCommandExceptionMessage& message) 135 void LoaderStateMachine::HandleExceptionMessage(const OracleCommandExceptionMessage& message)
136 { 136 {
137 LOG(ERROR) << "LoaderStateMachine::HandleExceptionMessage: error in the state machine, stopping all processing"; 137 LOG(ERROR) << "LoaderStateMachine::HandleExceptionMessage: error in the state machine, stopping all processing. Caller: "
138 << message.GetOrigin().GetCallerName();
138 LOG(ERROR) << "Error: " << message.GetException().What() << " Details: " << 139 LOG(ERROR) << "Error: " << message.GetException().What() << " Details: " <<
139 message.GetException().GetDetails(); 140 message.GetException().GetDetails();
140 Clear(); 141 Clear();
141 } 142 }
142 143
143 template <typename T> 144 template <typename T>
144 void LoaderStateMachine::HandleSuccessMessage(const T& message) 145 void LoaderStateMachine::HandleSuccessMessage(const T& message)
145 { 146 {
153 dynamic_cast<State&>(message.GetOrigin().GetPayload()).Handle(message); 154 dynamic_cast<State&>(message.GetOrigin().GetPayload()).Handle(message);
154 Step(); 155 Step();
155 } 156 }
156 catch (Orthanc::OrthancException& e) 157 catch (Orthanc::OrthancException& e)
157 { 158 {
158 LOG(ERROR) << "Error in the state machine, stopping all processing: " << 159 LOG(ERROR) << "Error in the state machine, stopping all processing. Caller: " <<
159 e.What() << " Details: " << e.GetDetails(); 160 message.GetOrigin().GetCallerName() << ". Error: " << e.What() << " Details: " << e.GetDetails();
160 Clear(); 161 Clear();
161 } 162 }
162 } 163 }
163 } 164 }
164 165