Module: Zimbra::HandsoapErrors
Defined Under Namespace
Classes: NotFound, NotImplemented, SOAPFault
Constant Summary
collapse
- @@response =
nil
Instance Method Summary
collapse
Instance Method Details
#http_error? ⇒ Boolean
27
28
29
|
# File 'lib/zimbra/handsoap_service.rb', line 27
def http_error?
@@response && (500..599).include?(@@response.status)
end
|
#http_not_found? ⇒ Boolean
30
31
32
|
# File 'lib/zimbra/handsoap_service.rb', line 30
def http_not_found?
@@response && (400..499).include?(@@response.status)
end
|
#on_after_create_http_request(request) ⇒ Object
20
21
22
|
# File 'lib/zimbra/handsoap_service.rb', line 20
def on_after_create_http_request(request)
@@response = nil
end
|
#on_http_error(response) ⇒ Object
11
12
13
14
15
|
# File 'lib/zimbra/handsoap_service.rb', line 11
def on_http_error(response)
@@response = response
return nil if soap_fault_not_found?
report_error(response) if http_error?
end
|
#report_error(response) ⇒ Object
16
17
18
19
|
# File 'lib/zimbra/handsoap_service.rb', line 16
def report_error(response)
message = response.body.scan(/<faultstring>(.*)<\/faultstring>/).first.first
raise SOAPFault, message
end
|
#soap_fault_not_found? ⇒ Boolean
24
25
26
|
# File 'lib/zimbra/handsoap_service.rb', line 24
def soap_fault_not_found?
@@response && @@response.body =~ /no such/
end
|