/** * Render the given HttpException. * * @param \Symfony\Component\HttpKernel\Exception\HttpException $e * @return \Symfony\Component\HttpFoundation\Response */ protected function renderHttpException(HttpException $e) { $status = $e->getStatusCode(); if (view()->exists("csm::errors.{$status}")) { return response()->view("errors.{$status}", ['message' => $e->getMessage(), 'line' => $e->getLine(), 'file' => $e->getFile(), 'code' => $status, 'bodyId' => 'error.' . $status], $status); } else { return (new SymfonyDisplayer(config('app.debug')))->createResponse($e); } }
public function testShouldExtractDataToPost() { $parser = new ExceptionParser(); $eMessage = "Exception Test"; $exception = new HttpException(404, $eMessage); $eTrace = $exception->getTrace(); $eLine = $exception->getLine(); $eFile = $exception->getFile(); $parser->parse($exception); $reflection = new ReflectionObject($parser); $stack = $reflection->getProperty('stack'); $stack->setAccessible(true); $file = $reflection->getProperty('file'); $file->setAccessible(true); $line = $reflection->getProperty('line'); $line->setAccessible(true); $message = $reflection->getProperty('message'); $message->setAccessible(true); $this->assertInternalType('array', $stack->getValue($parser)); $this->assertEquals($eMessage, $message->getValue($parser)); $this->assertEquals($eFile, $file->getValue($parser)); $this->assertEquals($eLine, $line->getValue($parser)); }