Exception: KerberosAuthenticator::Krb5::LibCallError
- Inherits:
-
Error
- Object
- StandardError
- Error
- StandardError
- Error
- KerberosAuthenticator::Krb5::LibCallError
- Defined in:
- lib/kerberos_authenticator/krb5/error.rb
Overview
A Kerberos error returned from a library call as a ‘krb5_error_code`.
Instance Attribute Summary collapse
-
#error_code ⇒ Integer
readonly
The krb5_error_code used to convey the status of a Kerberos library operation.
Class Method Summary collapse
-
.raise_if_error(context_ptr = nil) { ... } ⇒ Integer
Used to wrap Kerberos library functions that return a krb5_error_code.
-
.release(pointer) ⇒ Object
private
Frees an error message.
Instance Method Summary collapse
-
#initialize(context_ptr, krb5_error_code) ⇒ LibCallError
constructor
Initializes a new LibCallError using an error code and the relevant Context to provide a friendly error message.
Constructor Details
#initialize(context_ptr, krb5_error_code) ⇒ LibCallError
Initializes a new LibCallError using an error code and the relevant Context to provide a friendly error message.
24 25 26 27 28 29 |
# File 'lib/kerberos_authenticator/krb5/error.rb', line 24 def initialize(context_ptr, krb5_error_code) @error_code = krb5_error_code , error_ptr = Krb5.(context_ptr, krb5_error_code) self.class.release(error_ptr) super String.new().force_encoding('UTF-8') end |
Instance Attribute Details
#error_code ⇒ Integer (readonly)
Returns the krb5_error_code used to convey the status of a Kerberos library operation.
|
# File 'lib/kerberos_authenticator/krb5/error.rb', line 12
|
Class Method Details
.raise_if_error(context_ptr = nil) { ... } ⇒ Integer
Used to wrap Kerberos library functions that return a krb5_error_code.
43 44 45 46 47 |
# File 'lib/kerberos_authenticator/krb5/error.rb', line 43 def self.raise_if_error(context_ptr = nil) err = yield return 0 if err.zero? raise self.new(context_ptr, err) end |
.release(pointer) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Frees an error message
34 35 36 |
# File 'lib/kerberos_authenticator/krb5/error.rb', line 34 def self.release(pointer) Krb5.(Context.context.ptr, pointer) end |