-
Notifications
You must be signed in to change notification settings - Fork 254
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
Raise Net::LDAP::ConnectionRefusedError when new connection is refused. #213
Changes from all commits
b3e67d3
4f0f4b2
d20ee69
edfa759
b4a3bd2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,22 @@ class Error < StandardError; end | |
|
||
class AlreadyOpenedError < Error; end | ||
class SocketError < Error; end | ||
class ConnectionRefusedError < Error; end | ||
class ConnectionRefusedError < Error; | ||
def initialize(*args) | ||
warn_deprecation_message | ||
super | ||
end | ||
|
||
def message | ||
warn_deprecation_message | ||
super | ||
end | ||
|
||
private | ||
def warn_deprecation_message | ||
warn "Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When an user use this exception, this will show this exception will be removed. how about this? @jch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks good. Could you add a test that captures stderr and asserts that this message is being printed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, @jch ! I did it. |
||
end | ||
end | ||
class NoOpenSSLError < Error; end | ||
class NoStartTLSResultError < Error; end | ||
class NoSearchBaseError < Error; end | ||
|
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 came to think no need to wrap
Errno::ECONNREFUSED
in this situation.@mtodd @jch How do you think?
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.
Personally, I prefer not wrapping the error because
Errno::ECONNREFUSED
is more descriptive and appropriate. In fact, I'd rather we didn't rescue any wrap any of the errors in this block. However, this would be a breaking change in the API and require changes to the caller. We're not at 1.0, but this does seem like a nasty surprise. How do you feel about making a PR that shows deprecation warnings?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.
sounds great to me 👍