Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/configuration/AphrontApplicationConfiguration.php
Show First 20 Lines • Show All 280 Lines • ▼ Show 20 Lines | try { | ||||
$this->validateControllerResponse($controller, $response); | $this->validateControllerResponse($controller, $response); | ||||
} | } | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
$original_exception = $ex; | $original_exception = $ex; | ||||
} catch (Throwable $ex) { | } catch (Throwable $ex) { | ||||
$original_exception = $ex; | $original_exception = $ex; | ||||
} | } | ||||
$response_exception = null; | |||||
try { | try { | ||||
if ($original_exception) { | if ($original_exception) { | ||||
$response = $this->handleThrowable($original_exception); | $response = $this->handleThrowable($original_exception); | ||||
} | } | ||||
$response = $this->produceResponse($request, $response); | $response = $this->produceResponse($request, $response); | ||||
$response = $controller->willSendResponse($response); | $response = $controller->willSendResponse($response); | ||||
$response->setRequest($request); | $response->setRequest($request); | ||||
self::writeResponse($sink, $response); | self::writeResponse($sink, $response); | ||||
} catch (Exception $response_exception) { | } catch (Exception $ex) { | ||||
$response_exception = $ex; | |||||
} catch (Throwable $ex) { | |||||
$response_exception = $ex; | |||||
} | |||||
if ($response_exception) { | |||||
// If we encountered an exception while building a normal response, then | // If we encountered an exception while building a normal response, then | ||||
amckinley: I think the `Throwable` vs `Exception` difference is worth putting in a comment here since I… | |||||
// encountered another exception while building a response for the first | // encountered another exception while building a response for the first | ||||
// exception, just throw the original exception. It is more likely to be | // exception, just throw the original exception. It is more likely to be | ||||
// useful and point at a root cause than the second exception we ran into | // useful and point at a root cause than the second exception we ran into | ||||
// while telling the user about it. | // while telling the user about it. | ||||
if ($original_exception) { | if ($original_exception) { | ||||
throw $original_exception; | throw $original_exception; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 548 Lines • Show Last 20 Lines |
I think the Throwable vs Exception difference is worth putting in a comment here since I would have naively assumed that this code was redundant.