summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam Mueller <adam.mathys@gmail.com>2020-07-21 14:09:17 -0700
committerAdam Mueller <adam.mathys@gmail.com>2020-07-21 14:09:17 -0700
commit13d41349671fe914d93a17eade80911aed887ca1 (patch)
tree7b4ae8c12d9528c7527095ab14d2769e251db166 /lib
parente6af942deb798793324bdf8924b9c8e144184374 (diff)
Fix handling of no results for address validation
According to the documentation, and some testing, the API will raise a Taxjar::Error::NotFound error if the API finds no addresses. Instead of raising this error to others, we should handle it ourselves and return nil/an empty array like we originally intended. https://developers.taxjar.com/api/reference/#post-validate-an-address
Diffstat (limited to 'lib')
-rw-r--r--lib/super_good/solidus_taxjar/addresses.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/super_good/solidus_taxjar/addresses.rb b/lib/super_good/solidus_taxjar/addresses.rb
index 0993a03..de91af9 100644
--- a/lib/super_good/solidus_taxjar/addresses.rb
+++ b/lib/super_good/solidus_taxjar/addresses.rb
@@ -47,6 +47,8 @@ module SuperGood
def taxjar_addresses(spree_address)
api.validate_spree_address(spree_address)
+ rescue Taxjar::Error::NotFound
+ []
end
def us