From c372080d76f8268fb2c633eebc87912f61cfcefd Mon Sep 17 00:00:00 2001 From: Shengting Cui Date: Tue, 23 Jul 2024 20:24:20 +0000 Subject: [PATCH] Revise throw message --- include/realizations/catchment/Formulation_Manager.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/realizations/catchment/Formulation_Manager.hpp b/include/realizations/catchment/Formulation_Manager.hpp index b446c683c2..04fa7e57c4 100644 --- a/include/realizations/catchment/Formulation_Manager.hpp +++ b/include/realizations/catchment/Formulation_Manager.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -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)); } }