Skip to content

Commit

Permalink
preparing 1.0.23
Browse files Browse the repository at this point in the history
  • Loading branch information
ruckus committed Feb 12, 2024
1 parent 07e4e68 commit ed8dc2d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.23 (2024-02-12)

Use Ruby try() to gracefully handle no method errors when parsing exceptions

## 1.0.22 (2023-07-12)

* Fintechqb 1967 enable service level logging (#600). Thanks @andymond
Expand Down
12 changes: 5 additions & 7 deletions lib/quickbooks/service/base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,6 @@ def response_is_error?
begin
@last_response_xml.xpath("//xmlns:IntuitResponse/xmlns:Fault")[0] != nil
rescue Nokogiri::XML::XPath::SyntaxError => exception
#puts @last_response_xml.to_xml.to_s
#puts "WTF: #{exception.inspect}:#{exception.backtrace.join("\n")}"
true
end
end
Expand All @@ -443,20 +441,20 @@ def parse_intuit_error
error = {:message => "", :detail => "", :type => nil, :code => 0, :intuit_tid => @last_response_intuit_tid}
fault = @last_response_xml.xpath("//xmlns:IntuitResponse/xmlns:Fault")[0]
if fault
error[:type] = fault.attributes['type'].value
error[:type] = fault.attributes['type'].try(:value)

error_element = fault.xpath("//xmlns:Error")[0]
if error_element
code_attr = error_element.attributes['code']
if code_attr
error[:code] = code_attr.value
error[:code] = code_attr.try(:value)
end
element_attr = error_element.attributes['element']
if element_attr
error[:element] = code_attr.value
error[:element] = code_attr.try(:value)
end
error[:message] = error_element.xpath("//xmlns:Message").text
error[:detail] = error_element.xpath("//xmlns:Detail").text
error[:message] = error_element.xpath("//xmlns:Message").try(:text)
error[:detail] = error_element.xpath("//xmlns:Detail").try(:text)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/quickbooks/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Quickbooks

VERSION = "1.0.22"
VERSION = "1.0.23"

end

0 comments on commit ed8dc2d

Please sign in to comment.