lib/soapy_cake/response.rb in soapy_cake-1.0.0 vs lib/soapy_cake/response.rb in soapy_cake-1.0.1

- old
+ new

@@ -17,11 +17,11 @@ private def typed_element(element) Helper.walk_tree(element) do |value, key| - next value.to_i if key.to_s.end_with?('_id') + next value.to_i if key.to_s.end_with?('_id') && !key.to_s.end_with?('tax_id') if /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.?\d*\z/.match(value) next DateTime.parse(value + format('%+03d:00', time_offset.to_i)) end @@ -40,9 +40,12 @@ end def check_errors! fault = sax.for_tag(:fault).first fail RequestFailed, fault[:reason][:text] if fault - fail RequestFailed, sax.for_tag(:Text).first unless sax.for_tag(:success).first == 'true' + unless sax.for_tag(:success).first == 'true' + message = sax.for_tag(:message).first || sax.for_tag(:Text).first || 'Unknown error' + fail RequestFailed, message + end end end end