FrenetGatewaydeFretes / frenet-magento2

Integrate your Magento 2 with Frenet Services in a simple way.
https://www.frenet.com.br
MIT License
19 stars 10 forks source link

hotfix: prevent exception on error logging #19

Closed ivanaugustobd closed 2 years ago

ivanaugustobd commented 2 years ago

Due to the $errorMessage variable on line 181 being of type object (returned by Magento\Shipping\Model\Carrier\AbstractCarrierOnline::getErrorMessage()), the error logging was causing a exception like this on checkout:

Error: Object of class Magento\Quote\Model\Quote\Address\RateResult\Error could not be converted to string in /app/vendor/frenet/frenet-magento2/Model/Carrier/Frenet.php:181

This PR solves this by using the correct getErrorMessage string on logging. Tested on Magento 2.4.3-p1 with PHP 7.4.