Exception: Distem::Lib::ClientError

Inherits:
DistemError
  • Object
show all
Defined in:
lib/distem/distemlib/errors.rb

Overview

An error occured when using the REST Client (see NetAPI::Client)

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ClientError) initialize(num = 0, desc = "", body = {})

Returns a new instance of ClientError



73
74
75
76
77
# File 'lib/distem/distemlib/errors.rb', line 73

def initialize(num = 0, desc = "", body = {})
  @num = num
  @desc = desc
  @body = body
end

Instance Attribute Details

- (Object) body (readonly)

Returns the value of attribute body



72
73
74
# File 'lib/distem/distemlib/errors.rb', line 72

def body
  @body
end

- (Object) desc (readonly)

Returns the value of attribute desc



72
73
74
# File 'lib/distem/distemlib/errors.rb', line 72

def desc
  @desc
end

- (Object) num (readonly)

Returns the value of attribute num



72
73
74
# File 'lib/distem/distemlib/errors.rb', line 72

def num
  @num
end

Instance Method Details

- (Object) to_s



79
80
81
82
83
84
85
86
87
# File 'lib/distem/distemlib/errors.rb', line 79

def to_s
  if body.is_a?(Hash) or body.is_a?(Array)
    body = @body.inspect 
  else
    body = @body
  end

  return "HTTP Status: #{@num},\nDescription: \"#{@desc}\",\nBody: #{body}\n"
end