diff --git a/php/src_base/AccessException.php b/php/src_base/AccessException.php index 0fe1c6d..13a4d4a 100644 --- a/php/src_base/AccessException.php +++ b/php/src_base/AccessException.php @@ -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"; diff --git a/php/src_base/StateException.php b/php/src_base/StateException.php index 8cc3d05..b54d13a 100644 --- a/php/src_base/StateException.php +++ b/php/src_base/StateException.php @@ -1,13 +1,13 @@