modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2023-12-28 19:33:05 +04:00
parent 506fbb1390
commit a5d1485ecf
2 changed files with 10 additions and 3 deletions

View File

@ -7,7 +7,14 @@ use Exception;
* Class AccessException: indiquer que la resource ou l'objet auquel on veut
* accéder n'est pas accessible. il s'agit donc d'une erreur de l'utilisateur
*/
class AccessException extends Exception {
class AccessException extends UserException {
static final function read_only(?string $dest=null, ?string $prefix=null): self {
if ($prefix) $prefix = "$prefix: ";
if ($dest === null) $dest = "this property";
$message = "$dest is read-only";
return new static($prefix.$message);
}
static final function immutable_object(?string $dest=null, ?string $prefix=null): self {
if ($prefix) $prefix = "$prefix: ";
if ($dest === null) $dest = "this object";

View File

@ -1,13 +1,13 @@
<?php
namespace nulib;
use Exception;
use LogicException;
/**
* Class StateException: indiquer que l'état dans lequel on se trouve est
* inattendu: il s'agit donc d'un bug
*/
class StateException extends Exception {
class StateException extends LogicException {
static final function not_implemented(?string $method=null, ?string $prefix=null): self {
if ($method === null) $method = "this method";
$message = "$method is not implemented";