mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
added generic error handling - for lazy people. :)
This commit is contained in:
parent
539456bf48
commit
1d40a2f6f1
27
webtools/addons/lib/error.php
Normal file
27
webtools/addons/lib/error.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Basic error functions for triggering fatal runtime errors.
|
||||
* This class is generally called when a page load should be terminated because of bad inputs.
|
||||
*
|
||||
* @package amo
|
||||
* @subpackage lib
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param string $error
|
||||
*/
|
||||
function triggerError($errorMessage=null,$errorTemplate='error.tpl')
|
||||
{
|
||||
$tpl =& new AMO_Smarty();
|
||||
|
||||
$tpl->assign(
|
||||
array(
|
||||
'error'=>$errorMessage,
|
||||
'content'=>$errorTemplate,
|
||||
'backtrace'=>debug_backtrace()
|
||||
)
|
||||
);
|
||||
|
||||
$tpl->display('inc/wrappers/nonav.tpl');
|
||||
exit;
|
||||
}
|
18
webtools/addons/tpl/error.tpl
Normal file
18
webtools/addons/tpl/error.tpl
Normal file
@ -0,0 +1,18 @@
|
||||
|
||||
<h1>Error Found</h1>
|
||||
<p>The was an error processing your request. Please check your inputs and try again.</p>
|
||||
<dl>
|
||||
{if $error}
|
||||
<dt>Error Message</dt>
|
||||
<dd>{$error}</dd>
|
||||
{/if}
|
||||
<dt>Backtrace</dt>
|
||||
<dd><pre>
|
||||
{foreach name=rows item=row from=$backtrace}
|
||||
{foreach name=row key=key item=item from=$row}
|
||||
{$key}: {$item}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
</pre></dd>
|
||||
</dl>
|
||||
|
Loading…
Reference in New Issue
Block a user