Mercurial > hg > orthanc
diff OrthancServer/OrthancRestApi/OrthancRestModalities.cpp @ 1165:0561f2087cc9
Fix reporting of errors in Orthanc Explorer when sending images to peers/modalities
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 18 Sep 2014 17:48:55 +0200 |
parents | 952cf9b6be83 |
children | 6e7e5ed91c2d |
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Thu Sep 18 17:18:26 2014 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Thu Sep 18 17:48:55 2014 +0200 @@ -80,12 +80,17 @@ { if (locker.GetConnection().Echo()) { + // Echo has succeeded call.GetOutput().AnswerBuffer("{}", "application/json"); + return; } } catch (OrthancException&) { } + + // Echo has failed + call.GetOutput().SignalError(HttpStatus_500_InternalServerError); } @@ -357,13 +362,20 @@ for (std::list<std::string>::const_iterator it = instances.begin(); it != instances.end(); ++it) { - job.AddCommand(new StoreScuCommand(context, p)).AddInput(*it); + job.AddCommand(new StoreScuCommand(context, p, false)).AddInput(*it); } job.SetDescription("HTTP request: Store-SCU to peer \"" + remote + "\""); - context.GetScheduler().SubmitAndWait(job); - call.GetOutput().AnswerBuffer("{}", "application/json"); + if (context.GetScheduler().SubmitAndWait(job)) + { + // Success + call.GetOutput().AnswerBuffer("{}", "application/json"); + } + else + { + call.GetOutput().SignalError(HttpStatus_500_InternalServerError); + } } @@ -421,13 +433,20 @@ for (std::list<std::string>::const_iterator it = instances.begin(); it != instances.end(); ++it) { - job.AddCommand(new StorePeerCommand(context, peer)).AddInput(*it); + job.AddCommand(new StorePeerCommand(context, peer, false)).AddInput(*it); } job.SetDescription("HTTP request: POST to peer \"" + remote + "\""); - context.GetScheduler().SubmitAndWait(job); - call.GetOutput().AnswerBuffer("{}", "application/json"); + if (context.GetScheduler().SubmitAndWait(job)) + { + // Success + call.GetOutput().AnswerBuffer("{}", "application/json"); + } + else + { + call.GetOutput().SignalError(HttpStatus_500_InternalServerError); + } }