-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RCORE-2242: Include pathname in exception thrown in File::rw_lock #8000
Conversation
Pull Request Test Coverage Report for Build jorgen.edelbo_421Details
💛 - Coveralls |
src/realm/util/file.cpp
Outdated
@@ -1152,6 +1152,11 @@ bool File::rw_lock(bool exclusive, bool non_blocking) | |||
// or the OS will deadlock when un-suspending the app. | |||
int mode = exclusive ? O_WRONLY | O_NONBLOCK : O_RDWR | O_NONBLOCK; | |||
|
|||
auto report_err = [path = m_fifo_path](int err, const char* msg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we worry about the cost of copying this string here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any reason for this to not just capture [this]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -1152,6 +1152,11 @@ bool File::rw_lock(bool exclusive, bool non_blocking) | |||
// or the OS will deadlock when un-suspending the app. | |||
int mode = exclusive ? O_WRONLY | O_NONBLOCK : O_RDWR | O_NONBLOCK; | |||
|
|||
auto report_err = [path = m_fifo_path](int err, const char* msg) { | |||
auto message = util::format("%1: %2, path = '%3'", msg, std::system_category().message(err), path); | |||
throw RuntimeError(ErrorCodes::FileOperationFailed, message); // LCOV_EXCL_LINE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we probably shouldn't worry about the cost of copying the string here, but should message
be moved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not. RuntimeError takes a std::string_view as parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 🇮🇹 when the tests all pass!
What, How & Why?
Fixes #7999 #8007
☑️ ToDos
bindgen/spec.yml
, if public C++ API changed