Slim/Handlers/Error.php 1 location
|
@@ 37-53 (lines=17) @@
|
| 34 |
|
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, \Exception $exception) |
| 35 |
|
{ |
| 36 |
|
$contentType = $this->determineContentType($request); |
| 37 |
|
switch ($contentType) { |
| 38 |
|
case 'application/json': |
| 39 |
|
$output = $this->renderJsonErrorMessage($exception); |
| 40 |
|
break; |
| 41 |
|
|
| 42 |
|
case 'text/xml': |
| 43 |
|
case 'application/xml': |
| 44 |
|
$output = $this->renderXmlErrorMessage($exception); |
| 45 |
|
break; |
| 46 |
|
|
| 47 |
|
case 'text/html': |
| 48 |
|
$output = $this->renderHtmlErrorMessage($exception); |
| 49 |
|
break; |
| 50 |
|
|
| 51 |
|
default: |
| 52 |
|
throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
$this->writeToErrorLog($exception); |
| 56 |
|
|
Slim/Handlers/NotFound.php 1 location
|
@@ 40-56 (lines=17) @@
|
| 37 |
|
$output = $this->renderPlainNotFoundOutput(); |
| 38 |
|
} else { |
| 39 |
|
$contentType = $this->determineContentType($request); |
| 40 |
|
switch ($contentType) { |
| 41 |
|
case 'application/json': |
| 42 |
|
$output = $this->renderJsonNotFoundOutput(); |
| 43 |
|
break; |
| 44 |
|
|
| 45 |
|
case 'text/xml': |
| 46 |
|
case 'application/xml': |
| 47 |
|
$output = $this->renderXmlNotFoundOutput(); |
| 48 |
|
break; |
| 49 |
|
|
| 50 |
|
case 'text/html': |
| 51 |
|
$output = $this->renderHtmlNotFoundOutput($request); |
| 52 |
|
break; |
| 53 |
|
|
| 54 |
|
default: |
| 55 |
|
throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType); |
| 56 |
|
} |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
$body = new Body(fopen('php://temp', 'r+')); |
Slim/Handlers/PhpError.php 1 location
|
@@ 37-52 (lines=16) @@
|
| 34 |
|
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, \Throwable $error) |
| 35 |
|
{ |
| 36 |
|
$contentType = $this->determineContentType($request); |
| 37 |
|
switch ($contentType) { |
| 38 |
|
case 'application/json': |
| 39 |
|
$output = $this->renderJsonErrorMessage($error); |
| 40 |
|
break; |
| 41 |
|
|
| 42 |
|
case 'text/xml': |
| 43 |
|
case 'application/xml': |
| 44 |
|
$output = $this->renderXmlErrorMessage($error); |
| 45 |
|
break; |
| 46 |
|
|
| 47 |
|
case 'text/html': |
| 48 |
|
$output = $this->renderHtmlErrorMessage($error); |
| 49 |
|
break; |
| 50 |
|
default: |
| 51 |
|
throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType); |
| 52 |
|
} |
| 53 |
|
|
| 54 |
|
$this->writeToErrorLog($error); |
| 55 |
|
|