Mercurial > hg > orthanc
diff Core/SystemToolbox.cpp @ 3521:793c141be598
added an option not to log ReadFile errors
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 23 Sep 2019 17:47:54 +0200 |
parents | c08bb6ac3b7f |
children | 94f4a18a79cc |
line wrap: on
line diff
--- a/Core/SystemToolbox.cpp Thu Sep 05 18:09:21 2019 +0200 +++ b/Core/SystemToolbox.cpp Mon Sep 23 17:47:54 2019 +0200 @@ -212,19 +212,23 @@ void SystemToolbox::ReadFile(std::string& content, - const std::string& path) + const std::string& path, + bool log) { if (!IsRegularFile(path)) { throw OrthancException(ErrorCode_RegularFileExpected, - "The path does not point to a regular file: " + path); + "The path does not point to a regular file: " + path, + log); } boost::filesystem::ifstream f; f.open(path, std::ifstream::in | std::ifstream::binary); if (!f.good()) { - throw OrthancException(ErrorCode_InexistentFile); + throw OrthancException(ErrorCode_InexistentFile, + "File not found: " + path, + log); } std::streamsize size = GetStreamSize(f);