diff Core/FileStorage/FilesystemStorage.cpp @ 1582:bd1889029cbb

encoding of exceptions
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 17:39:38 +0200
parents 23083810d543
children b1291df2f780
line wrap: on
line diff
--- a/Core/FileStorage/FilesystemStorage.cpp	Tue Aug 25 16:18:37 2015 +0200
+++ b/Core/FileStorage/FilesystemStorage.cpp	Tue Aug 25 17:39:38 2015 +0200
@@ -106,14 +106,14 @@
     {
       if (!boost::filesystem::is_directory(path.parent_path()))
       {
-        throw OrthancException("The subdirectory to be created is already occupied by a regular file");        
+        throw OrthancException(ErrorCode_DirectoryOverFile);
       }
     }
     else
     {
       if (!boost::filesystem::create_directories(path.parent_path()))
       {
-        throw OrthancException("Unable to create a subdirectory in the file storage");        
+        throw OrthancException(ErrorCode_FileStorageCannotWrite);
       }
     }
 
@@ -121,7 +121,7 @@
     f.open(path, std::ofstream::out | std::ios::binary);
     if (!f.good())
     {
-      throw OrthancException("Unable to create a new file in the file storage");
+      throw OrthancException(ErrorCode_FileStorageCannotWrite);
     }
 
     if (size != 0)
@@ -130,7 +130,7 @@
       if (!f.good())
       {
         f.close();
-        throw OrthancException("Unable to write to the new file in the file storage");
+        throw OrthancException(ErrorCode_FileStorageCannotWrite);
       }
     }