Add a new custom error, try to import the TypeErroMethod in composer.json
continuous-integration/drone/push Build is passing Details

master
dorian.hodin 2 years ago
parent 9d87ee2c83
commit 233efb7dba

@ -6,5 +6,10 @@
"slim/slim": "^4.11",
"slim/psr7": "dev-master",
"psr/http-message": "^1.0"
},
"autoload": {
"psr-4": {
"ExceptionHandle\\" : "../ExceptionHandle"
}
}
}

@ -0,0 +1,19 @@
<?php
namespace ExceptionHandle;
use Psr\Http\Message\ServerRequestInterface;
use Slim\Exception\HttpSpecializedException;
use Throwable;
class HttpNotFoundError extends HttpSpecializedException {
protected $code = 404;
protected $message = "Wrong URL, verify the right call of the API. Exemple :'http://url?method=getSomething&id=5'";
public function __construct(ServerRequestInterface $request,?Throwable $previous = null)
{
parent::__construct($request, $this->message, $previous);
}
}

@ -1,9 +1,9 @@
<?php
use ExceptionHandle\TypeErrorMethod;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;
use ExceptionHandle\TypeErrorMethod;
require 'Config/vendor/autoload.php';

Loading…
Cancel
Save