class Conjur::Error

The base Conjur error class. Rescue it to catch errors generated by the Conjur services.

Public Class Methods

create(body) click to toggle source

Create a new instance based on structured error info. @param [String] body JSON error information @return [Error, nil] the exception instance or nil if body doesn’t

contain valid error info
# File lib/patches/conjur/error.rb, line 35
def self.create body
  error = JSON.parse(body)['error']
  kind = error['kind']
  klass = const_defined?(kind) && const_get(kind) || self
  klass.new error
rescue
  nil
end
new(error) click to toggle source
Calls superclass method
# File lib/patches/conjur/error.rb, line 90
def initialize error
  @error = error
  super message
end

Public Instance Methods

details() click to toggle source

@!attribute [r] details @return error details, as returned by the Conjur service @see message

# File lib/patches/conjur/error.rb, line 54
def details
  @error['details']
end
kind() click to toggle source

@!attribute [r] kind @return [String] error kind, as returned by the Conjur service @note Usually it will equal the class name.

# File lib/patches/conjur/error.rb, line 61
def kind
  @error['kind']
end
message() click to toggle source

@!attribute [r] message @return [String] human-readable error message, as returned by the Conjur service @see details

# File lib/patches/conjur/error.rb, line 47
def message
  @error['message']
end