Mercurial > hg > orthanc
diff Core/SystemToolbox.cpp @ 2954:d924f9bb61cc
taking advantage of details in OrthancException
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 03 Dec 2018 14:35:34 +0100 |
parents | 4a38d7d4f0e0 |
children | db8f360fcb41 |
line wrap: on
line diff
--- a/Core/SystemToolbox.cpp Mon Dec 03 11:49:39 2018 +0100 +++ b/Core/SystemToolbox.cpp Mon Dec 03 14:35:34 2018 +0100 @@ -216,8 +216,8 @@ { if (!IsRegularFile(path)) { - LOG(ERROR) << "The path does not point to a regular file: " << path; - throw OrthancException(ErrorCode_RegularFileExpected); + throw OrthancException(ErrorCode_RegularFileExpected, + "The path does not point to a regular file: " + path); } boost::filesystem::ifstream f; @@ -244,8 +244,8 @@ { if (!IsRegularFile(path)) { - LOG(ERROR) << "The path does not point to a regular file: " << path; - throw OrthancException(ErrorCode_RegularFileExpected); + throw OrthancException(ErrorCode_RegularFileExpected, + "The path does not point to a regular file: " + path); } boost::filesystem::ifstream f; @@ -484,11 +484,7 @@ if (pid == -1) { // Error in fork() -#if ORTHANC_ENABLE_LOGGING == 1 - LOG(ERROR) << "Cannot fork a child process"; -#endif - - throw OrthancException(ErrorCode_SystemCommand); + throw OrthancException(ErrorCode_SystemCommand, "Cannot fork a child process"); } else if (pid == 0) { @@ -507,11 +503,9 @@ if (status != 0) { -#if ORTHANC_ENABLE_LOGGING == 1 - LOG(ERROR) << "System command failed with status code " << status; -#endif - - throw OrthancException(ErrorCode_SystemCommand); + throw OrthancException(ErrorCode_SystemCommand, + "System command failed with status code " + + boost::lexical_cast<std::string>(status)); } }