Browse Source

Improve directory creation exception

Patrick-Christopher Mattulat 1 year ago
parent
commit
fb571b08c9
2 changed files with 5 additions and 1 deletions
  1. 1 1
      source/ls-std/io/File.cpp
  2. 4 0
      test/cases/io/FileTest.cpp

+ 1 - 1
source/ls-std/io/File.cpp

@@ -208,7 +208,7 @@ void File::makeDirectory()
 {
   if (!File::_makeDirectory(this->absoluteFilePath))
   {
-    throw FileOperationException{"operation: create directory"};
+    throw FileOperationException{R"lit(directory ")lit" + this->absoluteFilePath + R"lit(" could not be created!)lit"};
   }
 }
 

+ 4 - 0
test/cases/io/FileTest.cpp

@@ -322,6 +322,10 @@ namespace
           }
           catch (const FileOperationException &_exception)
           {
+            string expected = _exception.getName() + R"lit( thrown - directory ")lit" + TestHelper::getResourcesFolderLocation() + R"lit(list-test" could not be created!)lit";
+            string actual = _exception.what();
+
+            ASSERT_STREQ(expected.c_str(), actual.c_str());
             throw;
           }
         },