diff Core/TemporaryFile.cpp @ 3184:5d1f5984dc41

improved log
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 01 Feb 2019 09:28:12 +0100
parents 6fd38327e777
children 70524b4acc72
line wrap: on
line diff
--- 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");
     }
   }