ajoutUtilisateurs
This commit is contained in:
28
src/Exceptions/ConfigFailedLoadingException.php
Normal file
28
src/Exceptions/ConfigFailedLoadingException.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
/**
|
||||
* Exception qui se déclenche lorsqu'un fichier de configuration n'a pas pu être chargé.
|
||||
*
|
||||
* - Peut se déclencher si un fichier de configuration non voulu.
|
||||
*/
|
||||
class ConfigFailedLoadingException extends \Exception {
|
||||
|
||||
/**
|
||||
* Chemin vers le fichier de configuration manquant.
|
||||
* @var string
|
||||
*/
|
||||
public private(set) string $configFilePath;
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
* @param string $configFilePath Le fichier de configuration manquant.
|
||||
*/
|
||||
public function __construct( string $configFilePath ) {
|
||||
$this->configFilePath = $configFilePath;
|
||||
$this->message = "Failed to load configuration file '{$configFilePath}'.";
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
15
src/Exceptions/InvalidRouteException.php
Normal file
15
src/Exceptions/InvalidRouteException.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
class InvalidRouteException extends \Exception {
|
||||
|
||||
private string $clientRoute;
|
||||
|
||||
public function __construct(string $clientRoute)
|
||||
{
|
||||
$this->clientRoute = $clientRoute;
|
||||
$message = "{$clientRoute} doesn't exist";
|
||||
parent::__construct($message, 404);
|
||||
}
|
||||
|
||||
}
|
||||
13
src/Exceptions/InvalidViewException.php
Normal file
13
src/Exceptions/InvalidViewException.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
use Throwable;
|
||||
|
||||
class InvalidViewException extends \Exception {
|
||||
|
||||
public function __construct( string $viewName )
|
||||
{
|
||||
parent::__construct( "View {$viewName} does not exist.", 500 );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user