Skip to content

Instantly share code, notes, and snippets.

@Akii
Created April 7, 2015 18:57
Show Gist options
  • Save Akii/c64bc36537b36f82fcee to your computer and use it in GitHub Desktop.
Save Akii/c64bc36537b36f82fcee to your computer and use it in GitHub Desktop.
/**
* @Flow\Scope("singleton")
*/
class ApiProductionExceptionHandler extends ProductionExceptionHandler {
/**
* Only sends the HTTP header
*
* @param \Exception $exception The exception
* @return void
*/
protected function echoExceptionWeb(\Exception $exception) {
$statusCode = 500;
if ($exception instanceof \TYPO3\Flow\Exception) {
$statusCode = $exception->getStatusCode();
}
$statusMessage = \TYPO3\Flow\Http\Response::getStatusMessageByCode($statusCode);
if (!headers_sent()) {
header(sprintf('HTTP/1.1 %s %s', $statusCode, $statusMessage));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment