Skip to content

Commit 4f0f4b2

Browse files
committed
Raising Net::LDAP::ConnectionRefusedError, shows deprecation warning.
1 parent b3e67d3 commit 4f0f4b2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/net/ldap/error.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,21 @@ class Error < StandardError; end
99

1010
class AlreadyOpenedError < Error; end
1111
class SocketError < Error; end
12-
class ConnectionRefusedError < Error; end
12+
class ConnectionRefusedError < Error;
13+
def initialize(*args)
14+
warn warning_message
15+
super
16+
end
17+
18+
def message
19+
warning_message + super
20+
end
21+
22+
private
23+
def warning_message
24+
"Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead. \n"
25+
end
26+
end
1327
class NoOpenSSLError < Error; end
1428
class NoStartTLSResultError < Error; end
1529
class NoSearchBaseError < Error; end

0 commit comments

Comments
 (0)