Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

should add try... catch... statement #6

Closed
pigLoveRabbit520 opened this issue Apr 16, 2018 · 1 comment
Closed

should add try... catch... statement #6

pigLoveRabbit520 opened this issue Apr 16, 2018 · 1 comment
Labels
question Further information is requested

Comments

@pigLoveRabbit520
Copy link

pigLoveRabbit520 commented Apr 16, 2018

 $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)

@pigLoveRabbit520 pigLoveRabbit520 changed the title should try catch statement should add try... catch... statement Apr 16, 2018
@pachico pachico added the question Further information is requested label Apr 16, 2018
@pachico
Copy link
Owner

pachico commented Apr 16, 2018

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants