Skip to content

Commit

Permalink
Errors fix (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
aalyusuf authored Mar 15, 2022
1 parent 8944571 commit 11111f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Exceptions/CouldNotSendNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

class CouldNotSendNotification extends \Exception
{
public static function withErrors(array $errors): CouldNotSendNotification
public static function withErrors(string $response): CouldNotSendNotification
{
return new static('OneSignal responded with an error: `'.implode(',', $errors).'`');
return new static('OneSignal responded with an error: `'.$response.'`');
}
}
2 changes: 1 addition & 1 deletion src/OneSignalChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function send($notifiable, Notification $notification): ?object
$errors = $result->json('errors');

if (! empty($errors)) {
throw CouldNotSendNotification::withErrors($errors);
throw CouldNotSendNotification::withErrors($result->body());
}

return $result;
Expand Down

0 comments on commit 11111f8

Please sign in to comment.