lib/activeldap/ldap.rb in ruby-activeldap-debug-0.7.1 vs lib/activeldap/ldap.rb in ruby-activeldap-debug-0.7.2
- old
+ new
@@ -4,10 +4,13 @@
# Some portions Copyright 2006 Google Inc
module LDAP
+ class PrettyError < RuntimeError
+ end
+
ERRORS = [
"LDAP_SUCCESS",
"LDAP_OPERATIONS_ERROR",
"LDAP_PROTOCOL_ERROR",
"LDAP_TIMELIMIT_EXCEEDED",
@@ -73,11 +76,11 @@
# Make name into a exception
exc = err.gsub(/^LDAP_/, '')
exc = exc.split('_').collect {|w| w.capitalize }.join('')
# Doesn't exist :-)
LDAP.module_eval(<<-end_module_eval)
- class #{exc} < LDAP::ResultError
+ class #{exc} < LDAP::PrettyError
end
end_module_eval
hash[val] = exc
rescue NameError
# next!
@@ -101,5 +104,8 @@
exc = RuntimeError
end
return [exc, err2string(errno)]
end
end
+
+# Generate!
+LDAP::generate_err2exceptions()