2025-12-18 22:06:26 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Services\Fcm;
|
|
|
|
|
|
|
|
|
|
use Exception;
|
|
|
|
|
|
|
|
|
|
class FcmException extends Exception
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
string $message,
|
|
|
|
|
public readonly int $httpStatusCode = 0,
|
|
|
|
|
public readonly array $response = [],
|
|
|
|
|
?\Throwable $previous = null
|
|
|
|
|
) {
|
|
|
|
|
parent::__construct($message, 0, $previous);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* HTTP 응답에서 예외 생성
|
|
|
|
|
*/
|
|
|
|
|
public static function fromResponse(int $statusCode, array $response): self
|
|
|
|
|
{
|
|
|
|
|
$message = $response['error']['message'] ?? 'Unknown FCM error';
|
|
|
|
|
|
|
|
|
|
return new self($message, $statusCode, $response);
|
|
|
|
|
}
|
2025-12-18 23:01:06 +09:00
|
|
|
}
|