std::filesystem::create_directories() can throw an exception.
This patch adds the exception handling for the above case.
Change-Id: I37228b7b38ae1c9894ae2b1586429c39e8379e63
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
parent_path_ = path.parent_path();
file_name_ = path.filename();
if (!fs::exists(parent_path_)) {
- if (!fs::create_directories(parent_path_)) {
- _E("Failed to create directory. %s", parent_path_.c_str());
+ try {
+ if (!fs::create_directories(parent_path_)) {
+ _E("Failed to create directory. %s", parent_path_.c_str());
+ disposed_ = true;
+ return;
+ }
+ } catch (const std::exception& e) {
+ _E("Exception has been occurred: %s", e.what());
+ disposed_ = true;
return;
}
}