diff Platforms/Generic/WebServiceCommandBase.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 547e1cf7aa7b
children 8eb4fe74000f
line wrap: on
line diff
--- a/Platforms/Generic/WebServiceCommandBase.cpp	Tue Sep 25 15:14:53 2018 +0200
+++ b/Platforms/Generic/WebServiceCommandBase.cpp	Fri Sep 28 15:02:43 2018 +0200
@@ -31,6 +31,7 @@
                                                const Orthanc::WebServiceParameters& parameters,
                                                const std::string& uri,
                                                const IWebService::Headers& headers,
+                                               unsigned int timeoutInSeconds,
                                                Orthanc::IDynamicObject* payload /* takes ownership */,
                                                NativeStoneApplicationContext& context) :
     IObservable(broker),
@@ -40,7 +41,8 @@
     uri_(uri),
     headers_(headers),
     payload_(payload),
-    context_(context)
+    context_(context),
+    timeoutInSeconds_(timeoutInSeconds)
   {
   }
 
@@ -55,7 +57,7 @@
     }
     else if (!success_ && failureCallback_.get() != NULL)
     {
-      successCallback_->Apply(IWebService::HttpRequestErrorMessage(uri_, payload_.release()));
+      failureCallback_->Apply(IWebService::HttpRequestErrorMessage(uri_, payload_.release()));
     }
 
   }