Module: VCAP::Services::Base::Error

Defined Under Namespace

Classes: ServiceError

Instance Method Summary collapse

Instance Method Details

#failure(exception) ⇒ Object



101
102
103
# File 'lib/base/service_error.rb', line 101

def failure(exception)
  {'success' => false, 'response' => exception.to_hash}
end

#internal_failObject



105
106
107
108
# File 'lib/base/service_error.rb', line 105

def internal_fail()
  e = ServiceError.new(ServiceError::INTERNAL_ERROR)
  failure(e)
end

#parse_msg(msg) ⇒ Object



115
116
117
# File 'lib/base/service_error.rb', line 115

def parse_msg(msg)
  Yajl::Parser.parse(msg)
end

#success(response = true) ⇒ Object



97
98
99
# File 'lib/base/service_error.rb', line 97

def success(response = true)
  {'success' => true, 'response' => response}
end

#timeout_failObject



110
111
112
113
# File 'lib/base/service_error.rb', line 110

def timeout_fail()
  e = ServiceError.new(ServiceError::GATEWAY_TIMEOUT)
  failure(e)
end