Doc or gen_event:notify/2 Error!

Martin J. Logan <>
Wed Sep 10 17:34:35 CEST 2003


I will catch the error then. I think that having to take measures to
avoid a crash produced by my asynchronous call seems to run counter to
the spirit of asynchronous communication. Though I could be missing some
overriding reason to let it exit. 


On Wed, 2003-09-10 at 01:08, Gunilla Arendt wrote:
> Snip from the gen_event man page:
> 
> "Unless otherwise stated, all functions in this  module  fail
>  if  the  specified  event  manager  does not exist or if bad
>  arguments are given"
> 
> The same goes for gen_server and gen_fsm.
> 
> Regards, Gunilla
> 
> "Martin J. Logan" wrote:
> > 
> > Hello,
> >    I have found an inconsistency in the docs.
> > 
> > The docs indicate that the return value for gen_event notify is as
> > follows:
> > 
> > notify(EventMgrRef, Event) -> ok
> > 
> > This makes sense as it is asynchronous. I pass a registered name to a
> > notify call and if the name is not registered I get an exit(). It is the
> > same badarg exit that one would expect from
> > 
> > unregistered_name ! message
> > 
> > I think that either the docs should be changed to
> > 
> > notify(EventMgrRef, Event) -> ok | exit()
> > 
> > or more preferably the notify/2 function should not exit.
> > 
> > Cheers,
> > Martin
> > 
> > OUTPUT:
> > 
> > gen_event:notify(martin, martin).
> > 
> > =ERROR REPORT==== 9-Sep-2003::17:05:56 ===
> > Error in process <0.31.0> with exit value:
> > {badarg,[{gen_event,send,2},{erl_eval,do_apply,5},{shell,eval_loop,2}]}
> > 
> > ** exited: {badarg,[{gen_event,send,2},
> >                     {erl_eval,do_apply,5},
> >                     {shell,eval_loop,2}]} **




More information about the erlang-questions mailing list