Class: Frenetic::ResponseError

Inherits:
Error
  • Object
show all
Defined in:
lib/frenetic/errors.rb

Overview

Parent class for all specific exceptions which are raised as a result of a network response.

Direct Known Subclasses

ParsingError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ ResponseError

Returns a new instance of ResponseError.



128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/frenetic/errors.rb', line 128

def initialize(env)
  env ||= {}
  if env.respond_to?(:fetch)
    @body = env.fetch(:body, {})
    @env = env
    @error = @body['error']
    @method = env[:method]
    @status = env[:status]
    @url = env[:url]
  end
  super(message)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



127
128
129
# File 'lib/frenetic/errors.rb', line 127

def body
  @body
end

#envObject (readonly)

Returns the value of attribute env.



127
128
129
# File 'lib/frenetic/errors.rb', line 127

def env
  @env
end

#errorObject (readonly)

Returns the value of attribute error.



127
128
129
# File 'lib/frenetic/errors.rb', line 127

def error
  @error
end

#methodObject (readonly)

Returns the value of attribute method.



127
128
129
# File 'lib/frenetic/errors.rb', line 127

def method
  @method
end

#statusObject (readonly)

Returns the value of attribute status.



127
128
129
# File 'lib/frenetic/errors.rb', line 127

def status
  @status
end

#urlObject (readonly)

Returns the value of attribute url.



127
128
129
# File 'lib/frenetic/errors.rb', line 127

def url
  @url
end

Instance Method Details

#messageObject



141
142
143
# File 'lib/frenetic/errors.rb', line 141

def message
  @error
end