[Bro-Dev] Error handling for policy parser

Gregor Maier gregor at icir.org
Fri Dec 10 13:17:38 PST 2010


Also, should SetError() be used? (Which sets the type's tag to
TYPE_ERROR)??

On 12/10/10 13:10 , Gregor Maier wrote:
> Hi,
> 
> I was wondering on how errors should be handled when parsing policy
> script, esp. when parsing types (in my case enums).
> 
> Between Type.cc and parse.y it seem that three different strategies are
> used:
> 
>  a) The method / function from Type.cc returns a error indicator (int or
>     such) and parse.y calls error().
>  b) The method / function from Type.cc calls Error(), which it
>     inherited from BroObj()
>  c) The method / function from Type.cc calls error().
> 
> Which is the preferred way of reporting errors and/or are there reason
> to use or not use a particular variant?
> 
> (BTW, this is for the enum type stuff. The method in question is only
> called from parse.y to add element to the enum type. I kinda want to
> avoid a), because it involves code replication)
> 
> cu
> gregor


-- 
Gregor Maier                                             gregor at icir.org
Int. Computer Science Institute (ICSI)          gregor at icsi.berkeley.edu
1947 Center St., Ste. 600                    http://www.icir.org/gregor/
Berkeley, CA 94704
USA


More information about the bro-dev mailing list