diff --git a/cli/cron-heroku.php b/cli/cron-heroku.php index 8cea45463..6b70e77cb 100644 --- a/cli/cron-heroku.php +++ b/cli/cron-heroku.php @@ -16,9 +16,5 @@ $res = c::mailgun()->sendMessage(c::config()->mailgun->domain, [ -error_log('error_log'); - -$stderr = fopen('php://stderr', 'w'); -fwrite($stderr,'stderror'); -fclose($stderr); +throw new Exception('exception test'); diff --git a/include/library/Crunchbutton/App.php b/include/library/Crunchbutton/App.php index b19ac6729..4120fda56 100755 --- a/include/library/Crunchbutton/App.php +++ b/include/library/Crunchbutton/App.php @@ -188,6 +188,22 @@ class Crunchbutton_App extends Cana_App { } public function exception($e) { + $this->config()->db = null; + $backtracel = "\n
".$e->getMessage()."\n
";
+		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']."]
"; + } else { + $backtracel .= "#".$k." ".$v['function']."() called at [".$v['file'].":".$v['line']."]
"; + } + } + + if (getenv('HEROKU')) { + $stderr = fopen('php://stderr', 'w'); + fwrite($stderr, $backtracel); + fclose($stderr); + } + if ($this->env == 'live') { echo 'Error'. @@ -199,15 +215,6 @@ class Crunchbutton_App extends Cana_App { mail('_EMAIL','CRUNCHBUTTON CRITICAL ERROR',$e->getMessage()); exit; } else { - $this->config()->db = null; - echo "\n
".$e->getMessage()."\n
";
-			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']."]
"; - } else { - $backtracel .= "#".$k." ".$v['function']."() called at [".$v['file'].":".$v['line']."]
"; - } - } echo $backtracel; exit; } diff --git a/www/cron-heroku.php b/www/cron-heroku.php index 8cea45463..6b70e77cb 100644 --- a/www/cron-heroku.php +++ b/www/cron-heroku.php @@ -16,9 +16,5 @@ $res = c::mailgun()->sendMessage(c::config()->mailgun->domain, [ -error_log('error_log'); - -$stderr = fopen('php://stderr', 'w'); -fwrite($stderr,'stderror'); -fclose($stderr); +throw new Exception('exception test');