Mercurial > hg > orthanc
changeset 3184:5d1f5984dc41
improved log
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 01 Feb 2019 09:28:12 +0100 |
parents | 98187ab5a4c9 |
children | 92bbc5274220 4bbadcd03966 |
files | Core/Compression/ZipWriter.cpp Core/TemporaryFile.cpp OrthancServer/OrthancConfiguration.cpp |
diffstat | 3 files changed, 17 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/Compression/ZipWriter.cpp Fri Feb 01 09:08:29 2019 +0100 +++ b/Core/Compression/ZipWriter.cpp Fri Feb 01 09:28:12 2019 +0100 @@ -148,8 +148,8 @@ if (!pimpl_->file_) { - LOG(ERROR) << "Cannot create new ZIP archive: " << path_; - throw OrthancException(ErrorCode_CannotWriteFile); + throw OrthancException(ErrorCode_CannotWriteFile, + "Cannot create new ZIP archive: " + path_); } } @@ -210,8 +210,8 @@ if (result != 0) { - LOG(ERROR) << "Cannot add new file inside ZIP archive: " << path; - throw OrthancException(ErrorCode_CannotWriteFile); + throw OrthancException(ErrorCode_CannotWriteFile, + "Cannot add new file inside ZIP archive: " + std::string(path)); } hasFileInZip_ = true; @@ -242,8 +242,8 @@ if (zipWriteInFileInZip(pimpl_->file_, data, bytes)) { - LOG(ERROR) << "Cannot write data to ZIP archive: " << path_; - throw OrthancException(ErrorCode_CannotWriteFile); + throw OrthancException(ErrorCode_CannotWriteFile, + "Cannot write data to ZIP archive: " + path_); } data += bytes;
--- a/Core/TemporaryFile.cpp Fri Feb 01 09:08:29 2019 +0100 +++ b/Core/TemporaryFile.cpp Fri Feb 01 09:28:12 2019 +0100 @@ -100,13 +100,13 @@ { SystemToolbox::WriteFile(content, path_); } - catch (OrthancException&) + catch (OrthancException& e) { - LOG(ERROR) << "Can't create temporary file \"" << path_ - << "\" with " << content.size() - << " bytes: Check you have write access to the " - << "temporary directory and that it is not full"; - throw; + throw OrthancException(e.GetErrorCode(), + "Can't create temporary file \"" + path_ + + "\" with " + boost::lexical_cast<std::string>(content.size()) + + " bytes: Check you have write access to the " + "temporary directory and that it is not full"); } } @@ -117,11 +117,11 @@ { SystemToolbox::ReadFile(content, path_); } - catch (OrthancException&) + catch (OrthancException& e) { - LOG(ERROR) << "Can't read temporary file \"" << path_ - << "\": Another process has corrupted the temporary directory"; - throw; + throw OrthancException(e.GetErrorCode(), + "Can't read temporary file \"" + path_ + + "\": Another process has corrupted the temporary directory"); } }
--- a/OrthancServer/OrthancConfiguration.cpp Fri Feb 01 09:08:29 2019 +0100 +++ b/OrthancServer/OrthancConfiguration.cpp Fri Feb 01 09:28:12 2019 +0100 @@ -834,7 +834,7 @@ { if (json_.isMember(TEMPORARY_DIRECTORY)) { - return new TemporaryFile(GetStringParameter(TEMPORARY_DIRECTORY, ""), ""); + return new TemporaryFile(InterpretStringParameterAsPath(GetStringParameter(TEMPORARY_DIRECTORY, ".")), ""); } else {