Fixed JSON mime type and exception handling

This commit is contained in:
Marcin Kurczewski 2013-10-06 19:53:33 +02:00
parent 2cd7541042
commit 34bf6b1db7
2 changed files with 4 additions and 1 deletions

View file

@ -58,7 +58,9 @@ class Bootstrap
} }
catch (Exception $e) catch (Exception $e)
{ {
$this->context->exception = $e; $this->context->transport->errorMessage = rtrim($e->getMessage(), '.') . '.';
$this->context->transport->exception = $e;
$this->context->transport->success = false;
$this->context->viewName = 'error-exception'; $this->context->viewName = 'error-exception';
(new \Chibi\View())->renderFile($this->context->layoutName); (new \Chibi\View())->renderFile($this->context->layoutName);
} }

View file

@ -1 +1,2 @@
<?php \Chibi\HeadersHelper::set('Content-Type', 'application/json') ?>
<?php echo json_encode($this->context->transport, true) ?> <?php echo json_encode($this->context->transport, true) ?>