heroku exception tests
This commit is contained in:
parent
bb99da029b
commit
dd41b3d7a3
@ -16,9 +16,5 @@ $res = c::mailgun()->sendMessage(c::config()->mailgun->domain, [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
error_log('error_log');
|
throw new Exception('exception test');
|
||||||
|
|
||||||
$stderr = fopen('php://stderr', 'w');
|
|
||||||
fwrite($stderr,'stderror');
|
|
||||||
fclose($stderr);
|
|
||||||
|
|
||||||
|
|||||||
@ -188,6 +188,22 @@ class Crunchbutton_App extends Cana_App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function exception($e) {
|
public function exception($e) {
|
||||||
|
$this->config()->db = null;
|
||||||
|
$backtracel = "\n<br />".$e->getMessage()."\n<br /><pre>";
|
||||||
|
foreach($e->getTrace() as $k=>$v){
|
||||||
|
if ($v['function'] == "include" || $v['function'] == "include_once" || $v['function'] == "require_once" || $v['function'] == "require"){
|
||||||
|
$backtracel .= "#".$k." ".$v['function']."(".$v['args'][0].") called at [".$v['file'].":".$v['line']."]<br />";
|
||||||
|
} else {
|
||||||
|
$backtracel .= "#".$k." ".$v['function']."() called at [".$v['file'].":".$v['line']."]<br />";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getenv('HEROKU')) {
|
||||||
|
$stderr = fopen('php://stderr', 'w');
|
||||||
|
fwrite($stderr, $backtracel);
|
||||||
|
fclose($stderr);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->env == 'live') {
|
if ($this->env == 'live') {
|
||||||
echo
|
echo
|
||||||
'<title>Error</title><style>body {font-family: sans-serif; }.wrapper{ width: 400px; margin: 0 auto; margin-top: 25px;}</style>'.
|
'<title>Error</title><style>body {font-family: sans-serif; }.wrapper{ width: 400px; margin: 0 auto; margin-top: 25px;}</style>'.
|
||||||
@ -199,15 +215,6 @@ class Crunchbutton_App extends Cana_App {
|
|||||||
mail('_EMAIL','CRUNCHBUTTON CRITICAL ERROR',$e->getMessage());
|
mail('_EMAIL','CRUNCHBUTTON CRITICAL ERROR',$e->getMessage());
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
$this->config()->db = null;
|
|
||||||
echo "\n<br />".$e->getMessage()."\n<br /><pre>";
|
|
||||||
foreach($e->getTrace() as $k=>$v){
|
|
||||||
if ($v['function'] == "include" || $v['function'] == "include_once" || $v['function'] == "require_once" || $v['function'] == "require"){
|
|
||||||
$backtracel .= "#".$k." ".$v['function']."(".$v['args'][0].") called at [".$v['file'].":".$v['line']."]<br />";
|
|
||||||
} else {
|
|
||||||
$backtracel .= "#".$k." ".$v['function']."() called at [".$v['file'].":".$v['line']."]<br />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo $backtracel;
|
echo $backtracel;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,9 +16,5 @@ $res = c::mailgun()->sendMessage(c::config()->mailgun->domain, [
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
error_log('error_log');
|
throw new Exception('exception test');
|
||||||
|
|
||||||
$stderr = fopen('php://stderr', 'w');
|
|
||||||
fwrite($stderr,'stderror');
|
|
||||||
fclose($stderr);
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user