Exception: Spree::Tax::ProviderError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/spree/core/tax/provider_error.rb

Overview

A tax engine did not produce tax for a sale. Providers raise one of the two subclasses below; core rescues this and refuses the sale rather than completing one whose tax nobody computed — charging nothing because nobody could be asked is the error a merchant discovers in a filing.

Split because a customer can only act on one of them. Retrying an outage may work; retrying a postcode the engine rejects never will, and telling someone to try again is worse than telling them nothing.

The parallel is Pricing::PriceResolution::ProviderUnavailable, which refuses a sale whose prices could not be confirmed. Neither is for a provider a merchant switched off: that is configuration, not failure, and an unconfigured engine simply has no opinion and writes no rows.

Direct Known Subclasses

CalculationRefused, ProviderUnavailable

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, provider_key: nil) ⇒ ProviderError

Returns a new instance of ProviderError.



20
21
22
23
# File 'lib/spree/core/tax/provider_error.rb', line 20

def initialize(message = nil, provider_key: nil)
  @provider_key = provider_key
  super(message)
end

Instance Attribute Details

#provider_key ⇒ String? (readonly)

Returns which engine failed, for the report.

Returns:

  • (String, nil) —

    which engine failed, for the report



18
19
20
# File 'lib/spree/core/tax/provider_error.rb', line 18

def provider_key
  @provider_key
end