Exception: YieldStarClient::ServerError
- Inherits:
-
StandardError
- Object
- StandardError
- YieldStarClient::ServerError
- Defined in:
- lib/yield_star_client/errors.rb
Overview
Represents a server-side error returned by the YieldStar web service.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Class Method Summary collapse
-
.translate_fault(soap_error) ⇒ YieldStarClient::ServerError
Translates a soap fault into the appropriate YieldStarClient error.
Instance Method Summary collapse
-
#initialize(message = nil, code = nil) ⇒ ServerError
constructor
Creates a new error object.
Constructor Details
#initialize(message = nil, code = nil) ⇒ ServerError
Creates a new error object.
11 12 13 14 |
# File 'lib/yield_star_client/errors.rb', line 11 def initialize(=nil, code=nil) super() @code = code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
4 5 6 |
# File 'lib/yield_star_client/errors.rb', line 4 def code @code end |
Class Method Details
.translate_fault(soap_error) ⇒ YieldStarClient::ServerError
Translates a soap fault into the appropriate YieldStarClient error.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/yield_star_client/errors.rb', line 20 def self.translate_fault(soap_error) fault = soap_error.to_hash[:fault] # set up defaults error_class = YieldStarClient::ServerError fault_detail = {:code => fault[:faultcode], :message => fault[:faultstring]} if detail = fault[:detail] if detail.has_key?(:authentication_fault) error_class = YieldStarClient::AuthenticationError fault_detail = detail[:authentication_fault] elsif detail.has_key?(:operation_fault) error_class = YieldStarClient::OperationError fault_detail = detail[:operation_fault] elsif detail.has_key?(:internal_error_fault) error_class = YieldStarClient::InternalError fault_detail = detail[:internal_error_fault] end end error_class.new(fault_detail[:message], fault_detail[:code]) end |