nur-sery/src/ExitException.php

23 lines
549 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 {
function __construct(int $exitcode=0, $user_message=null, Throwable $previous=null) {
parent::__construct($user_message, null, $exitcode, $previous);
}
function isError(): bool {
return $this->getCode() !== 0;
}
function haveMessage(): bool {
return $this->getUserMessage() !== null;
}
}