-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Ran into this error:
NoMethodError: undefined method `body' for #<Hash:0x00007f83c0310fd8>
from solidus_avatax_certified/response/base.rb:13:in `result'
from tax_svc.rb:49:in `handle_response'
from tax_svc.rb:43:in `validate_address'
from solidus_avatax_certified/address.rb:53:in `validation_response'
from solidus_avatax_certified/address.rb:46:in `validate'
from models/solidus_avatax_certified/spree/order_decorator.rb:47:in `validate_ship_address'
I have not been able to reproduce it again as it seems related to an error being raised from avatax api that is no longer happening. From what I can see, validate_address is trapping the exception and changing the request to point at a Hash.
def validate_address(address)
begin
request = client.addresses.validate(address)
rescue StandardError => e
logger.error(e)
request = { 'error' => { 'message' => e } }
end
response = SolidusAvataxCertified::Response::AddressValidation.new(request)
handle_response(response)
endThen handle_response calls response.result
def handle_response(response)
result = response.result
begin
if response.error?
raise SolidusAvataxCertified::RequestError, result
end
logger.debug(result, response.description + ' Response')
rescue SolidusAvataxCertified::RequestError => e
logger.error(e.message, response.description + ' Error')
raise if raise_exceptions?
end
response
endThis calls faraday.body but now faraday is pointing at a Hash and we get this error:
def result
@result ||= faraday.body
endLet me know if this makes sense. Thx.
Metadata
Metadata
Assignees
Labels
No labels