summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-22 11:33:56 -0700
committerBrion Vibber <brion@pobox.com>2010-03-22 11:33:56 -0700
commit4168b9cec1f7b2e6421c018e56e3b9a13c14d581 (patch)
tree17444dd9d6191d93b422d1cd53b67d11ed72ba97
parent3bb639699c7a5e7e96c0d048adbe48a3ed486fc9 (diff)
Log backtraces for non-ClientException exceptions caught at the top-level handler.
-rw-r--r--index.php4
-rw-r--r--lib/servererroraction.php9
2 files changed, 8 insertions, 5 deletions
diff --git a/index.php b/index.php
index 36ba3a0d2..ea5c80277 100644
--- a/index.php
+++ b/index.php
@@ -324,10 +324,10 @@ function main()
$cac = new ClientErrorAction($cex->getMessage(), $cex->getCode());
$cac->showPage();
} catch (ServerException $sex) { // snort snort guffaw
- $sac = new ServerErrorAction($sex->getMessage(), $sex->getCode());
+ $sac = new ServerErrorAction($sex->getMessage(), $sex->getCode(), $sex);
$sac->showPage();
} catch (Exception $ex) {
- $sac = new ServerErrorAction($ex->getMessage());
+ $sac = new ServerErrorAction($ex->getMessage(), 500, $ex);
$sac->showPage();
}
}
diff --git a/lib/servererroraction.php b/lib/servererroraction.php
index 0993a63bc..9b5a553dc 100644
--- a/lib/servererroraction.php
+++ b/lib/servererroraction.php
@@ -62,15 +62,18 @@ class ServerErrorAction extends ErrorAction
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported');
- function __construct($message='Error', $code=500)
+ function __construct($message='Error', $code=500, $ex=null)
{
parent::__construct($message, $code);
$this->default = 500;
// Server errors must be logged.
-
- common_log(LOG_ERR, "ServerErrorAction: $code $message");
+ $log = "ServerErrorAction: $code $message";
+ if ($ex) {
+ $log .= "\n" . $ex->getTraceAsString();
+ }
+ common_log(LOG_ERR, $log);
}
// XXX: Should these error actions even be invokable via URI?