lib/xeroizer/exceptions.rb in xeroizer-2.15.8 vs lib/xeroizer/exceptions.rb in xeroizer-2.15.9
- old
+ new
@@ -26,9 +26,19 @@
end
def message
"#{@type}: #{@message} \n Generated by the following XML: \n #{@xml}"
end
+
+ def validation_errors
+ errors = []
+ @parsed_xml.xpath("//ValidationError").each do |err|
+ errors << err.text.gsub(/^\s+/, '').gsub(/\s+$/, '')
+ end
+ errors
+ rescue
+ []
+ end
end
class UnparseableResponse < StandardError