@@ -57,19 +57,19 @@ def each_pair
5757 state = :key_oid
5858 key << char
5959 when ' ' then state = :key
60- else raise "DN badly formed"
60+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
6161 end
6262 when :key_normal then
6363 case char
6464 when '=' then state = :value
6565 when 'a' ..'z' , 'A' ..'Z' , '0' ..'9' , '-' , ' ' then key << char
66- else raise "DN badly formed"
66+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
6767 end
6868 when :key_oid then
6969 case char
7070 when '=' then state = :value
7171 when '0' ..'9' , '.' , ' ' then key << char
72- else raise "DN badly formed"
72+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
7373 end
7474 when :value then
7575 case char
@@ -110,7 +110,7 @@ def each_pair
110110 when '0' ..'9' , 'a' ..'f' , 'A' ..'F' then
111111 state = :value_normal
112112 value << "#{ hex_buffer } #{ char } " . to_i ( 16 ) . chr
113- else raise "DN badly formed"
113+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
114114 end
115115 when :value_quoted then
116116 case char
@@ -132,7 +132,7 @@ def each_pair
132132 when '0' ..'9' , 'a' ..'f' , 'A' ..'F' then
133133 state = :value_quoted
134134 value << "#{ hex_buffer } #{ char } " . to_i ( 16 ) . chr
135- else raise "DN badly formed"
135+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
136136 end
137137 when :value_hexstring then
138138 case char
@@ -145,14 +145,14 @@ def each_pair
145145 yield key . string . strip , value . string . rstrip
146146 key = StringIO . new
147147 value = StringIO . new ;
148- else raise "DN badly formed"
148+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
149149 end
150150 when :value_hexstring_hex then
151151 case char
152152 when '0' ..'9' , 'a' ..'f' , 'A' ..'F' then
153153 state = :value_hexstring
154154 value << char
155- else raise "DN badly formed"
155+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
156156 end
157157 when :value_end then
158158 case char
@@ -162,14 +162,14 @@ def each_pair
162162 yield key . string . strip , value . string . rstrip
163163 key = StringIO . new
164164 value = StringIO . new ;
165- else raise "DN badly formed"
165+ else raise Net :: LDAP :: InvalidDNError , "DN badly formed"
166166 end
167- else raise "Fell out of state machine"
167+ else raise Net :: LDAP :: InvalidDNError , "Fell out of state machine"
168168 end
169169 end
170170
171171 # Last pair
172- raise "DN badly formed" unless
172+ raise Net :: LDAP :: InvalidDNError , "DN badly formed" unless
173173 [ :value , :value_normal , :value_hexstring , :value_end ] . include? state
174174
175175 yield key . string . strip , value . string . rstrip
0 commit comments