Interpreter exceptions occurring in "when" blocks are now handled.

The scripting error that caused the exception is still reported, but
it no longer causes Bro to terminate.  Addresses #779
This commit is contained in:
Jon Siwek 2012-12-04 12:38:09 -06:00
parent 05e6289719
commit f7440375f1
3 changed files with 92 additions and 3 deletions

View file

@ -217,8 +217,15 @@ bool Trigger::Eval()
Name());
Unref(v);
v = 0;
stmt_flow_type flow;
v = body->Exec(f, flow);
try
{
v = body->Exec(f, flow);
}
catch ( InterpreterException& e )
{ /* Already reported. */ }
if ( is_return )
{
@ -300,7 +307,14 @@ void Trigger::Timeout()
{
stmt_flow_type flow;
Frame* f = frame->Clone();
Val* v = timeout_stmts->Exec(f, flow);
Val* v = 0;
try
{
v = timeout_stmts->Exec(f, flow);
}
catch ( InterpreterException& e )
{ /* Already reported. */ }
if ( is_return )
{
@ -382,7 +396,7 @@ void Trigger::Attach(Trigger *trigger)
void Trigger::Cache(const CallExpr* expr, Val* v)
{
if ( disabled )
if ( disabled || ! v )
return;
ValCache::iterator i = cache.find(expr);