Exception: Vibe::Error::ServiceError

Inherits:
VibeError
  • Object
show all
Defined in:
lib/vibe/error/service_error.rb

Instance Attribute Summary collapse

Attributes inherited from VibeError

#response_headers, #response_message

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ ServiceError

Returns a new instance of ServiceError.



7
8
9
10
# File 'lib/vibe/error/service_error.rb', line 7

def initialize(env)
  super(generate_message(env))
  @http_headers = env[:response_headers]
end

Instance Attribute Details

#http_headersObject

Returns the value of attribute http_headers.



5
6
7
# File 'lib/vibe/error/service_error.rb', line 5

def http_headers
  @http_headers
end

Instance Method Details

#generate_message(env) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/vibe/error/service_error.rb', line 12

def generate_message(env)
  if ENV['DEBUG']
    "#{env[:method].to_s.upcase} #{env[:url].to_s}: #{env[:status]} #{env[:body]}"
  else
    env[:body]
  end
end