Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Jul 10, 2012
@kudos kudos Add sane handling of errors that happen before the frapi error handle…
…r has been initialised
086bd02
Commits on Nov 01, 2012
David Coallier Merge pull request #183 from kudos/watamerrorhandling
Add sane handling of errors that happen before the frapi error handler has been initialised
ec4b884
Showing with 8 additions and 7 deletions.
  1. +8 −7 src/frapi/library/Frapi/Controller/Api.php
View
15 src/frapi/library/Frapi/Controller/Api.php
@@ -208,14 +208,15 @@ public static function processInternalError(Frapi_Exception $e)
->populateOutput($e->getErrorArray())
->sendHeaders($e)
->executeOutput();
+ } catch(Frapi_Error $e) {
+ // If it's just a Frapi_Error, we want to rethrow it.
+ throw $e;
} catch (Exception $e) {
- // This is a hack to intercept anything that may
- // have happened before the internal error collection
- // during the initialisation process.
- //
- // If we got here, we have no controller and cannot properly handle
- // output, so we just send a 500 and die.
-
+ // We have no controller or error handler,
+ // so send some indication somewhere that things went wrong.
+ ob_start();
+ debug_print_backtrace();
+ error_log(ob_get_clean());
header("HTTP/1.0 500 Internal Server Error");
exit;

No commit comments for this range

Something went wrong with that request. Please try again.