23 lines
546 B
PHP
23 lines
546 B
PHP
<?php
|
|
namespace nulib;
|
|
|
|
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;
|
|
}
|
|
}
|