Mercurial > hg > orthanc
diff Core/JobsEngine/JobStepResult.cpp @ 3240:e44e0127e553
Fix issue #134 (/patient/modify gives 500, should really be 400)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 15 Feb 2019 17:26:45 +0100 |
parents | 4e43e67f8ecf |
children | 94f4a18a79cc |
line wrap: on
line diff
--- a/Core/JobsEngine/JobStepResult.cpp Fri Feb 15 16:38:12 2019 +0100 +++ b/Core/JobsEngine/JobStepResult.cpp Fri Feb 15 17:26:45 2019 +0100 @@ -46,14 +46,28 @@ } - JobStepResult JobStepResult::Failure(const ErrorCode& error) + JobStepResult JobStepResult::Failure(const ErrorCode& error, + const char* details) { JobStepResult result(JobStepCode_Failure); result.error_ = error; + + if (details != NULL) + { + result.failureDetails_ = details; + } + return result; } + JobStepResult JobStepResult::Failure(const OrthancException& exception) + { + return Failure(exception.GetErrorCode(), + exception.HasDetails() ? exception.GetDetails() : NULL); + } + + unsigned int JobStepResult::GetRetryTimeout() const { if (code_ == JobStepCode_Retry) @@ -78,4 +92,17 @@ throw OrthancException(ErrorCode_BadSequenceOfCalls); } } + + + const std::string& JobStepResult::GetFailureDetails() const + { + if (code_ == JobStepCode_Failure) + { + return failureDetails_; + } + else + { + throw OrthancException(ErrorCode_BadSequenceOfCalls); + } + } }