some thoughts on error handling
| From: | Marc Logemann | Date: | Sun, 25 Mar 2001 13:22:49 +0000 |
| Subject: | some thoughts on error handling | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-430@lists.php.net to get a copy of this message | ||
Hi,
i ran into really time consuming error checking with smarty, of course the
error was my fault, but the time to find him was crazy.
It seems that smarty doesnt allways print out messages like "parser error in foo.tpl",
instead sometimes smarty breaks and displays only a white screen. And this for
each page on the entire site!!
My following error:
{include file="_contentheader.tpl" title="Job-Matrix editieren: {$matrixname}"}
It should be no problem to see this one, but if you upload 30 changed template
files and see the problem on each page (the blank problem), searching can be horrable.
Then i got into the code, after about 1 hour, i noticed that smarty compiles template
files which are missing in the directory. In _traverse_files() function i debuged the main
loop and saw on which template smarty broke.
After another while :) i saw it exactly in the _compile_file() function, where
smarty died in the array-loop (* Compile the template tags into the PHP Code*).
THe reason for breaking is of course clear, but i dont know how to understand
the proceeding of smarty. If you start of with an empty cache dir and one
of your templates is broken, it seems that sometimes you wont get any results
in your entire site because of the compile-die.
Am i totally wrong or should the internal error handling be upgraded in some way?
Its really horrable that one mistake can break your entire site. If one
template is broken, it should be skipped and the next files in the template
directory should be compiled as normal...
So a logging mechanism would be good, right now i inserted my own debug line
in the traverse_files() function in oder to see what template is broken.
So..enough for today...its 5 am, and i am really weird now :) But anyway this
gave me the chance to look into your code more deeply, its allways good
to have an inside view...perhaps i will need this view for future enhancements :)
-----------------------
Marc Logemann
Morelogs GmbH & Co. KG
Chief Software Architect
-----------------------
Besuchen Sie uns auf der Cebit 2001
Halle 6 Stand C32