Skip to content

Instantly share code, notes, and snippets.

@domgetter
Forked from bodgix/excpetions.rb
Last active December 29, 2015 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domgetter/0a22c26723f58ebb27b4 to your computer and use it in GitHub Desktop.
Save domgetter/0a22c26723f58ebb27b4 to your computer and use it in GitHub Desktop.
begin # start catching exceptions here
ldap = Net::LDAP.open(
:host => host,
:port => port,
:auth => {
:method => :simple,
:username => CONFIG['repldn'],
:password => CONFIG['replpw']
}
)
unless ldap.bind
LOG.warn "connected to #{host}:#{port} but bind failed."
exit 3
end
end
# Bind was succesful, let's use the server from now on.
# I want to end the exception handling block, but I'm in a nested block now
# How to do that without ending the block to whom ldap was yielded?
ldap.search()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment