From 6994cc27c1bd118c67ee99ba79d0bd6cb2e13b20 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 9 Dec 2007 07:37:16 +0000 Subject: [PATCH] "using exception instead of exit, thought I can not yet remove the options to ignore the fatal error, as they might be used" --- phpgwapi/inc/class.Template.inc.php | 35 ++++++++++++----------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/phpgwapi/inc/class.Template.inc.php b/phpgwapi/inc/class.Template.inc.php index c8c506cf9d..ce57550392 100644 --- a/phpgwapi/inc/class.Template.inc.php +++ b/phpgwapi/inc/class.Template.inc.php @@ -453,34 +453,27 @@ return true; } - /***************************************************************************/ - /* public: halt(string $msg) - * msg: error message to show. + /** + * Giving a error message and halt the execution (if $this->halt_on_error == 'yes') + * + * @param string $msg error message to show */ function halt($msg) { $this->last_error = $msg; - if ($this->halt_on_error != 'no') + switch ($this->halt_on_error) { - $this->haltmsg($msg); + case 'no': + // ignore error quitely + break; + case 'report': + printf("Template Error: %s
\n", $msg); + echo "Backtrace: ".function_backtrace(2)."
\n"; + break; + case 'yes': + throw new egw_exception_wrong_parameter('Template Error: '.$msg); } - - if ($this->halt_on_error == 'yes') - { - echo('Halted.'); - } - - $GLOBALS['phpgw']->common->phpgw_exit(True); - } - - /* public, override: haltmsg($msg) - * msg: error message to show. - */ - function haltmsg($msg) - { - printf("Template Error: %s
\n", $msg); - echo "Backtrace: ".function_backtrace(2)."
\n"; } function check_debug($str)