Skip to content

Commit bec98c3

Browse files
committed
PSMDB-810 output more information in case of exception while copying
1 parent 598a093 commit bec98c3

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,11 +2081,26 @@ Status WiredTigerKVEngine::hotBackup(OperationContext* opCtx, const std::string&
20812081
// more fine-grained copy
20822082
copy_file_size(srcFile, destFile, fsize);
20832083
} catch (const fs::filesystem_error& ex) {
2084-
return Status(ErrorCodes::InvalidPath, ex.what());
2084+
return Status(ErrorCodes::InvalidPath,
2085+
"filesystem_error while copying '{}' to '{}': ({}/{}): {}"_format(
2086+
srcFile.string(),
2087+
destFile.string(),
2088+
ex.code().value(),
2089+
ex.code().message(),
2090+
ex.what()));
2091+
} catch (const std::system_error& ex) {
2092+
return Status(
2093+
ErrorCodes::InternalError,
2094+
"system_error while copying '{}' to '{}': ({}/{}): {}"_format(srcFile.string(),
2095+
destFile.string(),
2096+
ex.code().value(),
2097+
ex.code().message(),
2098+
ex.what()));
20852099
} catch (const std::exception& ex) {
2086-
return Status(ErrorCodes::InternalError, ex.what());
2100+
return Status(ErrorCodes::InternalError,
2101+
"exception while copying '{}' to '{}': {}"_format(
2102+
srcFile.string(), destFile.string(), ex.what()));
20872103
}
2088-
20892104
}
20902105

20912106
return Status::OK();

0 commit comments

Comments
 (0)