From bb0e844e4ee7e3ea6b8bf7f971ca860b201c2305 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Tue, 5 Nov 2013 09:27:34 +0100 Subject: [PATCH] In case of misisng view file, render in JSON --- lib/chibi-core | 2 +- src/Bootstrap.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/chibi-core b/lib/chibi-core index beeb483b..0ec5cbda 160000 --- a/lib/chibi-core +++ b/lib/chibi-core @@ -1 +1 @@ -Subproject commit beeb483bbeef8102fb54f7197d693b0934f063e1 +Subproject commit 0ec5cbda4b34f6273e2e02196cf6c16379623bb3 diff --git a/src/Bootstrap.php b/src/Bootstrap.php index 69b4a1a2..dcb66a0b 100644 --- a/src/Bootstrap.php +++ b/src/Bootstrap.php @@ -51,6 +51,12 @@ class Bootstrap $this->context->viewName = 'error-simple'; (new \Chibi\View())->renderFile($this->context->layoutName); } + catch (\Chibi\MissingViewFileException $e) + { + $this->context->json = true; + $this->context->layoutName = 'layout-json'; + (new \Chibi\View())->renderFile($this->context->layoutName); + } catch (Exception $e) { $this->context->transport->errorMessage = rtrim($e->getMessage(), '.') . '.';