23 lines
549 B
PHP
23 lines
549 B
PHP
|
<?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;
|
||
|
}
|
||
|
}
|