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 { try {
echo $this->dsn." ".$this->login." ".$this->password; echo $this->dsn." ".$this->login." ".$this->password;
$connection = new Connection($this->dsn,$this->login,$this->password); $connection = new Connection($this->dsn,$this->login,$this->password);
}catch (PDOException){ }catch (PDOException $e){
throw new PDOException(); throw new PDOException($e->getMessage(), $e->getCode(), $e);
} }
return $connection; return $connection;
} }

@ -10,11 +10,10 @@ class PDOError extends HttpSpecializedException {
protected $code = 408; protected $code = 408;
protected string $title = "PDO connection failed"; 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{ try{
$this->connection = (new ConnectClass)->connect(); $this->connection = (new ConnectClass)->connect();
}catch(PDOException $e){ }catch(PDOException $e){
echo $e->getMessage()." ET "; throw new PDOException($e->getMessage(), $e->getCode(), $e);
throw new PDOException();
} }
} }

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

Loading…
Cancel
Save