| 1 | <?php | ||
| 11 | final class CouldNotSendNotification extends RuntimeException | ||
| 12 | { | ||
| 13 | /** | ||
| 14 | * Thrown when channel identifier is missing. | ||
| 15 | * | ||
| 16 | * @return static | ||
| 17 | */ | ||
| 18 | public static function missingTo(): self | ||
| 19 |     { | ||
| 20 |         return new static('RocketChat notification was not sent. Channel identifier is missing.'); | ||
| 21 | } | ||
| 22 | |||
| 23 | /** | ||
| 24 | * Thrown when user or app access token is missing. | ||
| 25 | * | ||
| 26 | * @return static | ||
| 27 | */ | ||
| 28 | 1 | public static function missingFrom(): self | |
| 32 | |||
| 33 | /** | ||
| 34 | * Thrown when there's a bad response from the RocketChat. | ||
| 35 | * | ||
| 36 | * @param \GuzzleHttp\Exception\ClientException $exception | ||
| 37 | * @return static | ||
| 38 | */ | ||
| 39 | public static function rocketChatRespondedWithAnError(ClientException $exception): self | ||
| 46 | |||
| 47 | /** | ||
| 48 | * Thrown when we're unable to communicate with RocketChat. | ||
| 49 | * | ||
| 50 | * @param \Exception $exception | ||
| 51 | * @return static | ||
| 52 | */ | ||
| 53 | 2 | public static function couldNotCommunicateWithRocketChat(Exception $exception): self | |
| 57 | } | ||
| 58 |