Properly handle exception within templates

* fixes partial printed templates when exception is thrown in between
This commit is contained in:
Morris Jobke 2016-04-14 11:22:38 +02:00
parent 54f6c05c79
commit 12f1adb7bb
No known key found for this signature in database
GPG Key ID: 9CE5ED29E7FCD38A
1 changed files with 7 additions and 2 deletions

View File

@ -168,8 +168,13 @@ class Base {
// Include
ob_start();
include $file;
$data = ob_get_contents();
try {
include $file;
$data = ob_get_contents();
} catch (\Exception $e) {
@ob_end_clean();
throw $e;
}
@ob_end_clean();
// Return data