-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add exception classes #110
base: master
Are you sure you want to change the base?
Add exception classes #110
Conversation
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.
Sorry for the later review. I like the direction, but have some comments.
src/mysql/connection.cr
Outdated
end | ||
|
||
class UnexpectedPacketError < PacketError | ||
getter :status |
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 would stick with getter status : UInt8
style
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'm admittedly inexperience with Crystal so I'll take the style advice, see 7fadad9.
src/mysql/connection.cr
Outdated
class PacketError < ConnectionError | ||
getter :packet | ||
|
||
def initialize(packet : ReadPacket, message) |
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 think ReadPacket should be exposed, it's an internal implementation detail.
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.
Check out the changes on c14f4e6; I'm hoping it addresses your concern.
1. Remove `PacketError` 2. Make `UnexpectedPacketError` inherit from `Exception` rather than `PacketError`
Fixes #109
While I used different classes for the exceptions, I wanted to keep some level of backward-compatibility by retaining the existing error messages.