summaryrefslogtreecommitdiff
path: root/lib/super_good
diff options
context:
space:
mode:
authorJared Norman <jared@super.gd>2019-02-05 10:36:04 -0800
committerJared Norman <jared@super.gd>2019-02-05 10:36:04 -0800
commita238148b1d66b9d5377b9c840b00b9e2ea4d4d7e (patch)
tree01f6616be059765034609d1ee0988c92833da815 /lib/super_good
parentc3b0d69b34955affc1f9a331447ce2baa8f3931a (diff)
Move exception handler configuration
Diffstat (limited to 'lib/super_good')
-rw-r--r--lib/super_good/solidus_taxjar.rb4
-rw-r--r--lib/super_good/solidus_taxjar/tax_calculator.rb9
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/super_good/solidus_taxjar.rb b/lib/super_good/solidus_taxjar.rb
index be56453..663b3d8 100644
--- a/lib/super_good/solidus_taxjar.rb
+++ b/lib/super_good/solidus_taxjar.rb
@@ -13,9 +13,13 @@ module SuperGood
class << self
attr_accessor :discount_calculator
attr_accessor :test_mode
+ attr_accessor :exception_handler
end
self.discount_calculator = ::SuperGood::SolidusTaxJar::DiscountCalculator
self.test_mode = false
+ self.exception_handler = ->(e) {
+ Rails.logger.error "An error occurred while fetching TaxJar tax rates - #{e}: #{e.message}"
+ }
end
end
diff --git a/lib/super_good/solidus_taxjar/tax_calculator.rb b/lib/super_good/solidus_taxjar/tax_calculator.rb
index b9e6444..a3c0690 100644
--- a/lib/super_good/solidus_taxjar/tax_calculator.rb
+++ b/lib/super_good/solidus_taxjar/tax_calculator.rb
@@ -1,11 +1,6 @@
module SuperGood
module SolidusTaxJar
class TaxCalculator
- class_attribute :exception_handler
- self.exception_handler = ->(e) {
- Rails.logger.error "An error occurred while fetching TaxJar tax rates - #{e}: #{e.message}"
- }
-
def self.default_api
::SuperGood::SolidusTaxJar::API.new
end
@@ -129,6 +124,10 @@ module SuperGood
end
end
end
+
+ def exception_handler
+ SuperGood::SolidusTaxJar.exception_handler
+ end
end
end
end