|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Nov 23, 2010 7:59 pm Post subject: Smarty 3: handling exceptions |
|
|
By default, Smarty throws PHP5 exceptions for critical errors. These errors, if uncaught, can be quite lengthy. To clean things up, you should catch the exceptions (from Smarty and your application in general) and handle them as necessary. Maybe you echo the error, log the error, etc.
Here is a simple example of catching exceptions and echoing just the error message itself:
Code: | try {
$smarty->display('index.tpl');
} catch(Exception $e) {
echo "Error: " . $e->getMessage();
} |
See the PHP documentation for more detailed information. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|