Exception: Shark::ApiError

Inherits:
Error
  • Object
show all
Defined in:
lib/shark/error.rb

Direct Known Subclasses

ClientError, ServerError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, env) ⇒ ApiError

Returns a new instance of ApiError.



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

def initialize(code, env)
  @code = code
  @env = env
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



7
8
9
# File 'lib/shark/error.rb', line 7

def code
  @code
end

#envObject (readonly)

Returns the value of attribute env.



7
8
9
# File 'lib/shark/error.rb', line 7

def env
  @env
end

Instance Method Details

#bodyObject



14
15
16
# File 'lib/shark/error.rb', line 14

def body
  env[:body]
end

#messageObject



22
23
24
# File 'lib/shark/error.rb', line 22

def message
  body.to_s
end

#urlObject



18
19
20
# File 'lib/shark/error.rb', line 18

def url
  env[:url]
end