Relay the error in all file
continuous-integration/drone/push Build is passing Details

master
dorian.hodin 2 years ago
parent f980673877
commit 85ae251770

@ -23,8 +23,8 @@ class ConnectClass{
try {
echo $this->dsn." ".$this->login." ".$this->password;
$connection = new Connection($this->dsn,$this->login,$this->password);
}catch (PDOException){
throw new PDOException();
}catch (PDOException $e){
throw new PDOException($e->getMessage(), $e->getCode(), $e);
}
return $connection;
}

@ -10,11 +10,10 @@ class PDOError extends HttpSpecializedException {
protected $code = 408;
protected string $title = "PDO connection failed";
protected $message = "The connection method throw a PDO Exception, connection to database failed";
public function __construct(ServerRequestInterface $request,?Throwable $previous = null)
public function __construct(ServerRequestInterface $request,string $message, ?Throwable $previous = null)
{
parent::__construct($request, $this->message, $previous);
parent::__construct($request, $message,$previous);
}
}

@ -16,8 +16,7 @@ class GatewayForm
try{
$this->connection = (new ConnectClass)->connect();
}catch(PDOException $e){
echo $e->getMessage()." ET ";
throw new PDOException();
throw new PDOException($e->getMessage(), $e->getCode(), $e);
}
}

@ -45,9 +45,8 @@ $app->get('/', function (Request $request, Response $response) {
$ok = true;
$response->getBody()->write(json_encode((new $gateway)->$method($parameters)));
}
}catch (PDOException){
echo "ici?";
throw new PDOError($request);
}catch (PDOException $e){
throw new PDOError($request,$e->getMessage(),$e);
}
}
if (!$ok){

Loading…
Cancel
Save