Skip to content

Commit 492c624

Browse files
leganzManuel.PirkerIhl
authored andcommitted
Fix #69 issue by checking if response structure contains a "error" attribute
1 parent ade739c commit 492c624

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Exceptions/CouldNotSendNotification.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ class CouldNotSendNotification extends \Exception
1010
*/
1111
public static function serviceRespondsNotSuccessful($response)
1212
{
13+
if (isset($response->error)){
14+
return new static("Couldn't post notification. Response: ".$response->error);
15+
}
16+
1317
$responseBody = print_r($response->errors[0]->message, true);
1418

1519
return new static("Couldn't post notification. Response: ".$responseBody);

0 commit comments

Comments
 (0)