Module: VCAP::Services::Base::Error
- Included in:
- AsyncJob, AsyncJob::Lock, AsyncJob::Package, AsyncJob::Serialization::SerializationJob, AsyncJob::Snapshot, Base, SnapshotV2::SnapshotClient, VCAP::Services::BaseAsynchronousServiceGateway
- Defined in:
- lib/base/service_error.rb
Defined Under Namespace
Classes: ServiceError
Instance Method Summary collapse
- #failure(exception) ⇒ Object
- #internal_fail ⇒ Object
- #parse_msg(msg) ⇒ Object
- #success(response = true) ⇒ Object
- #timeout_fail ⇒ Object
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_fail ⇒ Object
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_fail ⇒ Object
110 111 112 113 |
# File 'lib/base/service_error.rb', line 110 def timeout_fail() e = ServiceError.new(ServiceError::GATEWAY_TIMEOUT) failure(e) end |