Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPlugins.cpp @ 2960:74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Dec 2018 18:56:39 +0100 |
parents | ccf61f6e22ef |
children | db8f360fcb41 |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Tue Dec 04 16:43:53 2018 +0100 +++ b/Plugins/Engine/OrthancPlugins.cpp Tue Dec 04 18:56:39 2018 +0100 @@ -324,10 +324,12 @@ private: HttpOutput& output_; std::auto_ptr<std::string> errorDetails_; + bool logDetails_; public: PluginHttpOutput(HttpOutput& output) : - output_(output) + output_(output), + logDetails_(false) { } @@ -336,9 +338,11 @@ return output_; } - void SetErrorDetails(const std::string& details) + void SetErrorDetails(const std::string& details, + bool logDetails) { errorDetails_.reset(new std::string(details)); + logDetails_ = logDetails; } bool HasErrorDetails() const @@ -346,6 +350,11 @@ return errorDetails_.get() != NULL; } + bool IsLogDetails() const + { + return logDetails_; + } + const std::string& GetErrorDetails() const { if (errorDetails_.get() == NULL) @@ -1069,7 +1078,8 @@ PImpl::PluginHttpOutput pluginOutput(output); - OrthancPluginErrorCode error = callback->Invoke(pimpl_->restCallbackMutex_, pluginOutput, flatUri, request); + OrthancPluginErrorCode error = callback->Invoke + (pimpl_->restCallbackMutex_, pluginOutput, flatUri, request); if (error == OrthancPluginErrorCode_Success && output.IsWritingMultipart()) @@ -1087,7 +1097,9 @@ if (pluginOutput.HasErrorDetails()) { - throw OrthancException(static_cast<ErrorCode>(error), pluginOutput.GetErrorDetails()); + throw OrthancException(static_cast<ErrorCode>(error), + pluginOutput.GetErrorDetails(), + pluginOutput.IsLogDetails()); } else { @@ -1389,8 +1401,9 @@ const _OrthancPluginSetHttpErrorDetails& p = *reinterpret_cast<const _OrthancPluginSetHttpErrorDetails*>(parameters); - PImpl::PluginHttpOutput* output = reinterpret_cast<PImpl::PluginHttpOutput*>(p.output); - output->SetErrorDetails(p.details); + PImpl::PluginHttpOutput* output = + reinterpret_cast<PImpl::PluginHttpOutput*>(p.output); + output->SetErrorDetails(p.details, p.log); }