Exception: WebfleetConnect::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/webfleet_connect/error.rb

Constant Summary collapse

SITE =
'https://www.webfleet.com'
PATH =
'/static/help/webfleet-connect/en_gb/index.html'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, url, is_json) ⇒ Error

Returns a new instance of Error.



11
12
13
14
15
16
17
# File 'lib/webfleet_connect/error.rb', line 11

def initialize(message, url, is_json)
  parser = build_parser(is_json)
  hash = parser.to_hash(message)
  @code = hash[:errorCode]
  @message = hash[:errorMsg]
  @url = url
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



9
10
11
# File 'lib/webfleet_connect/error.rb', line 9

def code
  @code
end

#urlObject (readonly)

Returns the value of attribute url.



9
10
11
# File 'lib/webfleet_connect/error.rb', line 9

def url
  @url
end

Instance Method Details

#messageObject



19
20
21
# File 'lib/webfleet_connect/error.rb', line 19

def message
  "#{code}, #{@message}\n\nCheck #{api_docs_url} for more details.\n\n"
end