-
Notifications
You must be signed in to change notification settings - Fork 321
Ensure RedisPipeline dtor not to throw #1115
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
base: master
Are you sure you want to change the base?
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Pull request overview
This PR adds exception handling to the RedisPipeline destructor to prevent exceptions from propagating out of the destructor, which is a C++ best practice. The change wraps the existing flush() call in a try-catch block that catches both std::exception and generic exceptions, logging appropriate error messages.
Key changes:
- Wrapped
flush()call in destructor with try-catch blocks to prevent exception propagation - Added error logging for both specific exceptions and unknown exceptions during flush
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
The coverage missing is due to no unit test covering proventative code path. It is easy to cover one line by shutdown redis. Other lines are difficult. There is challenge to cover them in unit test. It should be safe and no extra harm to merge. It is preventative code path. Originally code will crash in the same situation. catch (const std::exception& e)catch (...) |
Best practice says to not let exceptions propagate out of a destructor. So swallow any exception if it really throws in RedisPipeline class.