Skip to content

Commit

Permalink
PSMDB-810 output more information in case of exception while copying
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsol committed Feb 12, 2021
1 parent 598a093 commit bec98c3
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2081,11 +2081,26 @@ Status WiredTigerKVEngine::hotBackup(OperationContext* opCtx, const std::string&
// more fine-grained copy
copy_file_size(srcFile, destFile, fsize);
} catch (const fs::filesystem_error& ex) {
return Status(ErrorCodes::InvalidPath, ex.what());
return Status(ErrorCodes::InvalidPath,
"filesystem_error while copying '{}' to '{}': ({}/{}): {}"_format(
srcFile.string(),
destFile.string(),
ex.code().value(),
ex.code().message(),
ex.what()));
} catch (const std::system_error& ex) {
return Status(
ErrorCodes::InternalError,
"system_error while copying '{}' to '{}': ({}/{}): {}"_format(srcFile.string(),
destFile.string(),
ex.code().value(),
ex.code().message(),
ex.what()));
} catch (const std::exception& ex) {
return Status(ErrorCodes::InternalError, ex.what());
return Status(ErrorCodes::InternalError,
"exception while copying '{}' to '{}': {}"_format(
srcFile.string(), destFile.string(), ex.what()));
}

}

return Status::OK();
Expand Down

0 comments on commit bec98c3

Please sign in to comment.