Fixes for undefined array key 'message' error with postmark
This commit is contained in:
parent
925c934e73
commit
cb13104569
|
|
@ -249,8 +249,19 @@ class NinjaMailerJob implements ShouldQueue
|
|||
|
||||
if ($e instanceof PostmarkException) { //postmark specific failure
|
||||
|
||||
|
||||
try {
|
||||
$response = json_decode($e->getMessage(), true);
|
||||
if (is_array($response) && isset($response['Message'])) {
|
||||
$message = $response['Message'];
|
||||
}
|
||||
} catch (\Exception $jsonError) {
|
||||
// If JSON decode fails, use the original message
|
||||
$message = "Unknown issue sending via Postmark, please try again later.";
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
$this->entityEmailFailed($e->getMessage());
|
||||
$this->entityEmailFailed($message);
|
||||
$this->cleanUpMailers();
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -370,8 +370,6 @@ class Email implements ShouldQueue
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Post mark buries the proper message in a guzzle response
|
||||
* this merges a text string with a json object
|
||||
|
|
@ -379,8 +377,19 @@ class Email implements ShouldQueue
|
|||
*/
|
||||
if ($e instanceof PostmarkException) { //postmark specific failure
|
||||
|
||||
// Try to decode the JSON response if present
|
||||
try {
|
||||
$response = json_decode($e->getMessage(), true);
|
||||
if (is_array($response) && isset($response['Message'])) {
|
||||
$message = $response['Message'];
|
||||
}
|
||||
} catch (\Exception $jsonError) {
|
||||
// If JSON decode fails, use the original message
|
||||
$message = "Unknown issue sending via Postmark, please try again later.";
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
$this->entityEmailFailed($e->getMessage());
|
||||
$this->entityEmailFailed($message);
|
||||
$this->cleanUpMailers();
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -5169,16 +5169,16 @@
|
|||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v11.44.4",
|
||||
"version": "v11.44.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "6b29bb79b18474ea5265b7022ba7b0f76eebeb4f"
|
||||
"reference": "00bc6ac91a6d577bf051c18ddaa638c0d221e1c7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/6b29bb79b18474ea5265b7022ba7b0f76eebeb4f",
|
||||
"reference": "6b29bb79b18474ea5265b7022ba7b0f76eebeb4f",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/00bc6ac91a6d577bf051c18ddaa638c0d221e1c7",
|
||||
"reference": "00bc6ac91a6d577bf051c18ddaa638c0d221e1c7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
|
@ -5380,7 +5380,7 @@
|
|||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2025-04-23T23:35:40+00:00"
|
||||
"time": "2025-04-25T12:40:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/octane",
|
||||
|
|
|
|||
Loading…
Reference in New Issue