Skip to content

Commit a6d6ec8

Browse files
author
Tatsuya Sato
committed
Rename Net::LDAP::LdapError to Net::LDAP::Error
1 parent 1436abe commit a6d6ec8

File tree

3 files changed

+34
-31
lines changed

3 files changed

+34
-31
lines changed

lib/net/ldap.rb

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class LDAP
2626
require 'net/ldap/instrumentation'
2727
require 'net/ldap/connection'
2828
require 'net/ldap/version'
29+
require 'net/ldap/error'
2930

3031
# == Quick-start for the Impatient
3132
# === Quick Example of a user-authentication against an LDAP directory:
@@ -246,35 +247,6 @@ class LDAP
246247
class Net::LDAP
247248
include Net::LDAP::Instrumentation
248249

249-
class LdapError < StandardError; end
250-
class AlreadyOpenedError < LdapError; end
251-
class SocketError < LdapError; end
252-
class ConnectionRefusedError < LdapError; end
253-
class NoOpenSSLError < LdapError; end
254-
class NoStartTLSResultError < LdapError; end
255-
class StartTLSError < LdapError; end
256-
class EncryptionUnsupportedError < LdapError; end
257-
class EncMethodUnsupportedError < LdapError; end
258-
class AuthMethodUnsupportedError < LdapError; end
259-
class BindingInformationInvalidError < LdapError; end
260-
class NoBindResultError < LdapError; end
261-
class SASLChallengeOverflowError < LdapError; end
262-
class SearchSizeInvalidError < LdapError; end
263-
class SearchScopeInvalidError < LdapError; end
264-
class ResponseTypeInvalidError < LdapError; end
265-
class ResponseMissingOrInvalidError < LdapError; end
266-
class EmptyDNError < LdapError; end
267-
class HashTypeUnsupportedError < LdapError; end
268-
class OperatorError < LdapError; end
269-
class SubstringFilterError < LdapError; end
270-
class SearchFilterError < LdapError; end
271-
class BERInvalidError < LdapError; end
272-
class SearchFilterTypeUnknownError < LdapError; end
273-
class BadAttributeError < LdapError; end
274-
class FilterTypeUnknownError < LdapError; end
275-
class FilterSyntaxInvalidError < LdapError; end
276-
class EntryOverflowError < LdapError; end
277-
278250
SearchScope_BaseObject = 0
279251
SearchScope_SingleLevel = 1
280252
SearchScope_WholeSubtree = 2

lib/net/ldap/error.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
class Net::LDAP
2+
class Error < StandardError; end
3+
4+
class AlreadyOpenedError < Error; end
5+
class SocketError < Error; end
6+
class ConnectionRefusedError < Error; end
7+
class NoOpenSSLError < Error; end
8+
class NoStartTLSResultError < Error; end
9+
class StartTLSError < Error; end
10+
class EncryptionUnsupportedError < Error; end
11+
class EncMethodUnsupportedError < Error; end
12+
class AuthMethodUnsupportedError < Error; end
13+
class BindingInformationInvalidError < Error; end
14+
class NoBindResultError < Error; end
15+
class SASLChallengeOverflowError < Error; end
16+
class SearchSizeInvalidError < Error; end
17+
class SearchScopeInvalidError < Error; end
18+
class ResponseTypeInvalidError < Error; end
19+
class ResponseMissingOrInvalidError < Error; end
20+
class EmptyDNError < Error; end
21+
class HashTypeUnsupportedError < Error; end
22+
class OperatorError < Error; end
23+
class SubstringFilterError < Error; end
24+
class SearchFilterError < Error; end
25+
class BERInvalidError < Error; end
26+
class SearchFilterTypeUnknownError < Error; end
27+
class BadAttributeError < Error; end
28+
class FilterTypeUnknownError < Error; end
29+
class FilterSyntaxInvalidError < Error; end
30+
class EntryOverflowError < Error; end
31+
end

test/test_ldap_connection.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
class TestLDAPConnection < Test::Unit::TestCase
44
def test_unresponsive_host
5-
assert_raise Net::LDAP::LdapError do
5+
assert_raise Net::LDAP::Error do
66
Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
77
end
88
end
99

1010
def test_blocked_port
1111
flexmock(TCPSocket).should_receive(:new).and_raise(SocketError)
12-
assert_raise Net::LDAP::LdapError do
12+
assert_raise Net::LDAP::Error do
1313
Net::LDAP::Connection.new(:host => 'test.mocked.com', :port => 636)
1414
end
1515
end

0 commit comments

Comments
 (0)