should add try... catch... statement
pigLoveRabbit520 opened this issue · comments
pigLoveRabbit commented
$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)
Mariano Benítez Mulet commented
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.