Move output buffer clearing to individual handlers

This commit is contained in:
filp
2013-04-20 12:12:54 +01:00
parent 4dd812c456
commit c37eb037d2
4 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -43,4 +43,4 @@ $run->pushHandler($jsonHandler);
// That's it! Register Whoops and throw a dummy exception:
$run->register();
throw new RuntimeException("Oh fudge napkins!");
throw new RuntimeException("Oh fudge napkins!");
+4 -1
View File
@@ -71,6 +71,9 @@ class JsonResponseHandler extends Handler
return Handler::DONE;
}
// Remove any previous output
ob_get_level() and ob_end_clean();
$exception = $this->getException();
$response = array(
@@ -103,4 +106,4 @@ class JsonResponseHandler extends Handler
echo json_encode($response);
return Handler::QUIT;
}
}
}
+3
View File
@@ -58,6 +58,9 @@ class PrettyPageHandler extends Handler
if(php_sapi_name() === 'cli' && !isset($_ENV['whoops-test'])) {
return Handler::DONE;
}
// Remove any previous output
ob_get_level() and ob_end_clean();
// Get the 'pretty-template.php' template file
// @todo: this can be made more dynamic &&|| cleaned-up
-3
View File
@@ -144,9 +144,6 @@ class Run
*/
public function handleException(Exception $exception)
{
// Remove any previous output
ob_get_level() and ob_end_clean();
// Walk the registered handlers in the reverse order
// they were registered, and pass off the exception
$inspector = $this->getInspector($exception);