- enhancement: trap exceptions to keep a nice display in case of error

SVN:code[84]
This commit is contained in:
Denis Flaven
2009-07-19 09:32:44 +00:00
parent 4eb723b073
commit 039edd245d

View File

@@ -19,6 +19,8 @@ $oP = new iTopWebPage("iTop - Expression Evaluation", $currentOrganization);
$sExpression = utils::ReadParam('expression', ''); $sExpression = utils::ReadParam('expression', '');
$sEncoding = utils::ReadParam('encoding', 'oql'); $sEncoding = utils::ReadParam('encoding', 'oql');
try
{
if ($sEncoding == 'crypted') if ($sEncoding == 'crypted')
{ {
// Translate $sExpression into a oql expression // Translate $sExpression into a oql expression
@@ -52,6 +54,17 @@ if (!empty($sExpression))
cmdbAbstractObject::DisplaySet($oP, $oSet); cmdbAbstractObject::DisplaySet($oP, $oSet);
} }
} }
}
catch(CoreException $e)
{
$oP->p('<b>An error occured while running the query:</b>');
$oP->p($e->getHtmlDesc());
}
catch(Exception $e)
{
$oP->p('<b>An error occured while running the query:</b>');
$oP->p($e->getMessage());
}
$oP->output(); $oP->output();
?> ?>