Closed methane closed 2 months ago
The changes primarily involve refining the way mysqlConn
handles connection errors in various methods, ensuring that driver.ErrBadConn
is returned more appropriately. Additional logging has been minimized to reduce redundancy. Interface implementations for driver.SessionResetter
and driver.Validator
have been explicitly declared. These updates improve code clarity and error-handling efficiency.
Files | Change Summaries |
---|---|
connection.go |
Refactored error handling to conditionally return driver.ErrBadConn and removed redundant logging. Declared driver.SessionResetter and driver.Validator interfaces. |
errors.go |
Updated a comment for clarity regarding handling connection errors. |
statement.go |
Removed redundant error logging in CheckNamedValue and query functions. |
ErrBadConn
handling which aligns with the recent updates in this PR.In the world of code where bytes do dance, We tweaked our logic, seized the chance. Connections now more wisely marked, Errors less noisy, brightly sparked! Interfaces set, our mission clear, To make MySQL's path sincere. 🐇✨
[!WARNING]
Review ran into problems
Problems (1)
* Git: Failed to clone repository. Please contact CodeRabbit support.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Description
Logging ErrInvalidConn when the connection already closed doesn't provide any help to users.
Additonally, database/sql now uses Validator() to check connection liveness before calling query methods. So stop using
mc.log(ErrInvalidConn)
idiom.This PR includes some cleanup and documentation relating to
mc.markBadConn()
.Checklist
Summary by CodeRabbit
Refactor
Documentation
This update aims to streamline error management for a more efficient and cleaner user experience.