nur-sery/src/ExitException.php

23 lines
547 B
PHP
Raw Normal View History

2024-04-05 08:31:49 +04:00
<?php
namespace nur\sery;
use Throwable;
/**
* Class ExitException: une exception qui indique que l'application souhaite
* quitter normalement, avec éventuellement un code d'erreur.
*/
class ExitException extends UserException {
2024-05-20 17:35:53 +04:00
function __construct(int $exitcode=0, $userMessage=null, Throwable $previous=null) {
parent::__construct($userMessage, null, $exitcode, $previous);
2024-04-05 08:31:49 +04:00
}
function isError(): bool {
return $this->getCode() !== 0;
}
function haveMessage(): bool {
return $this->getUserMessage() !== null;
}
}