Module: Ldapter::Errors
- Defined in:
- lib/ldapter/errors.rb
Overview
The module houses all subclasses of Ldapter::ServerError. The methods contained within are for internal use only.
Defined Under Namespace
Classes: CompareFalse, CompareTrue, NoSuchObject
Constant Summary
- EXCEPTIONS =
{ 32 => NoSuchObject, 5 => CompareFalse, 6 => CompareTrue }
Class Method Summary (collapse)
-
+ (Object) application_backtrace
Provides a backtrace minus all files shipped with Ldapter.
-
+ (Object) for(code, message = nil)
:nodoc:.
-
+ (Object) raise(exception)
Raise an exception (object only, no strings or classes) with the backtrace stripped of all Ldapter files.
-
+ (Object) raise_unless_zero(code, message = nil)
Given an error code and a message, raise an Ldapter::ServerError unless the code is zero.
Class Method Details
+ (Object) application_backtrace
Provides a backtrace minus all files shipped with Ldapter.
100 101 102 103 104 105 |
# File 'lib/ldapter/errors.rb', line 100 def application_backtrace dir = File.dirname(File.dirname(__FILE__)) c = caller c.shift while c.first[0,dir.length] == dir c end |
+ (Object) for(code, message = nil)
:nodoc:
114 115 116 117 118 119 120 |
# File 'lib/ldapter/errors.rb', line 114 def for(code, = nil) #:nodoc: ||= "Unknown error #{code}" klass = EXCEPTIONS[code] || ServerError exception = klass.new() exception.code = code exception end |
+ (Object) raise(exception)
Raise an exception (object only, no strings or classes) with the backtrace stripped of all Ldapter files.
109 110 111 112 |
# File 'lib/ldapter/errors.rb', line 109 def raise(exception) exception.set_backtrace(application_backtrace) Kernel.raise exception end |
+ (Object) raise_unless_zero(code, message = nil)
Given an error code and a message, raise an Ldapter::ServerError unless the code is zero. The right subclass is selected automatically if it is available.
125 126 127 128 |
# File 'lib/ldapter/errors.rb', line 125 def raise_unless_zero(code, = nil) return if code.zero? raise self.for(code, ) end |