The issue is about when an error is catched and and an exception is thrown:
try {
$response = $gateway->purchase($data)->send();
} catch (\Exception $e) {
throw $e;
}
My situation is that I am running Laravel 5.5.4 locally, and on the remote server the project is running on Laravel 5.4.36.
Locally, throw $e results in that an object is returned with status code 500 , and the object looks something like:
{
"message": "Card number is invalid",
"exception": "Omnipay\\Common\\Exception\\InvalidCreditCardException",
"file": "C:\\path\path",
"line": 288,
"trace": [ (stuff) ]
I can print the error message by using the "message" property.
BUT on the server, throw $e results in returning status 500 with an html page - the "Whoops, looks like something went wrong." - page. That's not an object , so I can't get the error message.
I have tried setting "APP_DEBUG" to true or false, but it doesn't matter.
Is the difference in behaviour due to the difference in Laravel versions? Can I make a change so that throw $e returns an object in the same way as in the local version? How is this behaviour controlled?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire