comparison Platforms/Generic/Oracle.cpp @ 309:14ef1227120f am-callable-and-promise

web services: better handling of failures
author am@osimis.io
date Fri, 28 Sep 2018 15:02:43 +0200
parents 46c5296d867e
children b70e9be013e4
comparison
equal deleted inserted replaced
307:be2660b6e40a 309:14ef1227120f
64 64
65 std::auto_ptr<Orthanc::IDynamicObject> item(that->queue_.Dequeue(100)); 65 std::auto_ptr<Orthanc::IDynamicObject> item(that->queue_.Dequeue(100));
66 if (item.get() != NULL) 66 if (item.get() != NULL)
67 { 67 {
68 IOracleCommand& command = dynamic_cast<IOracleCommand&>(*item); 68 IOracleCommand& command = dynamic_cast<IOracleCommand&>(*item);
69 command.Execute(); 69 try
70 {
71 command.Execute();
72 }
73 catch (Orthanc::OrthancException& ex)
74 {
75 // this is probably a curl error that has been triggered. We may just ignore it.
76 // The command.success_ will stay at false and this will be handled in the command.Commit
77 }
70 78
71 // Random sleeping to test 79 // Random sleeping to test
72 //boost::this_thread::sleep(boost::posix_time::milliseconds(50 * (1 + rand() % 10))); 80 //boost::this_thread::sleep(boost::posix_time::milliseconds(50 * (1 + rand() % 10)));
73 81
74 command.Commit(); 82 command.Commit();