pachico / slim-swoole

Convenient library to run SlimPHP applications with Swoole

Home Page:https://github.com/pachico/slim-swoole/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

should add try... catch... statement

pigLoveRabbit520 opened this issue · comments

 $slimResponse = $this->app->process($slimRequest, new Http\Response());

Slim

 try {
    ob_start();
    $response = $this->process($this->container->get('request'), $response);
} catch (InvalidMethodException $e) {
    $response = $this->processInvalidMethod($e->getRequest(), $response);
} finally {
    $output = ob_get_clean();
}

According to the source code of Slim, here may throw a exception(InvalidMethodException)

Yes, indeed, you might see not only InvalidMethodException but a NotFoundException as well.
The example is does not contain it in order not to influence or suggest how to handle exceptions, which depends purely on your requirements.