Skip to content

Commit

Permalink
Revise throw message
Browse files Browse the repository at this point in the history
  • Loading branch information
stcui007 committed Jul 23, 2024
1 parent 1342d2b commit c372080
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/realizations/catchment/Formulation_Manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <functional>
#include <dirent.h>
#include <sys/stat.h>
#include <errno.h>
#include <regex>
#include <sys/types.h>
#include <unistd.h>
Expand Down Expand Up @@ -306,11 +307,12 @@ namespace realization {
if (stat(dir, &sb) == 0 && S_ISDIR(sb.st_mode))
return dir;
else {
errno = 0;
int result = mkdir(dir, 0755);
if (result == 0)
return dir;
else
throw std::runtime_error("mkdir " + std::string(dir) + " failed, please create " + std::string(dir));
throw std::runtime_error("failed to create directory '" + str + "': " + strerror(errno));
}
}

Expand Down

0 comments on commit c372080

Please sign in to comment.