Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
1164:0a55d8eb194e | 1165:0561f2087cc9 |
---|---|
78 | 78 |
79 try | 79 try |
80 { | 80 { |
81 if (locker.GetConnection().Echo()) | 81 if (locker.GetConnection().Echo()) |
82 { | 82 { |
83 // Echo has succeeded | |
83 call.GetOutput().AnswerBuffer("{}", "application/json"); | 84 call.GetOutput().AnswerBuffer("{}", "application/json"); |
85 return; | |
84 } | 86 } |
85 } | 87 } |
86 catch (OrthancException&) | 88 catch (OrthancException&) |
87 { | 89 { |
88 } | 90 } |
91 | |
92 // Echo has failed | |
93 call.GetOutput().SignalError(HttpStatus_500_InternalServerError); | |
89 } | 94 } |
90 | 95 |
91 | 96 |
92 static void DicomFindPatient(RestApiPostCall& call) | 97 static void DicomFindPatient(RestApiPostCall& call) |
93 { | 98 { |
355 | 360 |
356 ServerJob job; | 361 ServerJob job; |
357 for (std::list<std::string>::const_iterator | 362 for (std::list<std::string>::const_iterator |
358 it = instances.begin(); it != instances.end(); ++it) | 363 it = instances.begin(); it != instances.end(); ++it) |
359 { | 364 { |
360 job.AddCommand(new StoreScuCommand(context, p)).AddInput(*it); | 365 job.AddCommand(new StoreScuCommand(context, p, false)).AddInput(*it); |
361 } | 366 } |
362 | 367 |
363 job.SetDescription("HTTP request: Store-SCU to peer \"" + remote + "\""); | 368 job.SetDescription("HTTP request: Store-SCU to peer \"" + remote + "\""); |
364 context.GetScheduler().SubmitAndWait(job); | 369 |
365 | 370 if (context.GetScheduler().SubmitAndWait(job)) |
366 call.GetOutput().AnswerBuffer("{}", "application/json"); | 371 { |
372 // Success | |
373 call.GetOutput().AnswerBuffer("{}", "application/json"); | |
374 } | |
375 else | |
376 { | |
377 call.GetOutput().SignalError(HttpStatus_500_InternalServerError); | |
378 } | |
367 } | 379 } |
368 | 380 |
369 | 381 |
370 // Orthanc Peers ------------------------------------------------------------ | 382 // Orthanc Peers ------------------------------------------------------------ |
371 | 383 |
419 | 431 |
420 ServerJob job; | 432 ServerJob job; |
421 for (std::list<std::string>::const_iterator | 433 for (std::list<std::string>::const_iterator |
422 it = instances.begin(); it != instances.end(); ++it) | 434 it = instances.begin(); it != instances.end(); ++it) |
423 { | 435 { |
424 job.AddCommand(new StorePeerCommand(context, peer)).AddInput(*it); | 436 job.AddCommand(new StorePeerCommand(context, peer, false)).AddInput(*it); |
425 } | 437 } |
426 | 438 |
427 job.SetDescription("HTTP request: POST to peer \"" + remote + "\""); | 439 job.SetDescription("HTTP request: POST to peer \"" + remote + "\""); |
428 context.GetScheduler().SubmitAndWait(job); | 440 |
429 | 441 if (context.GetScheduler().SubmitAndWait(job)) |
430 call.GetOutput().AnswerBuffer("{}", "application/json"); | 442 { |
443 // Success | |
444 call.GetOutput().AnswerBuffer("{}", "application/json"); | |
445 } | |
446 else | |
447 { | |
448 call.GetOutput().SignalError(HttpStatus_500_InternalServerError); | |
449 } | |
431 } | 450 } |
432 | 451 |
433 | 452 |
434 // DICOM bridge ------------------------------------------------------------- | 453 // DICOM bridge ------------------------------------------------------------- |
435 | 454 |