[erlang-questions] throwing from gen_server:init/1

Dmitry Demeshchuk <>
Wed Nov 23 15:51:43 CET 2011


Why not returning {stop, Reason} instead?

On Wed, Nov 23, 2011 at 6:50 PM, Joel Reymont <> wrote:
> I'm passing a proplist to the init function of my gen_server.
>
> I need to ensure various options are present and validate them.
>
> I also don't want to have a huge nested case statement.
>
> Is it acceptable to throw or error when I cannot find or validate an option?
>
> Are there better ideas?
>
> N.B. The option values are assigned to fields of the gen_server state records.
>
> --------------------------------------------------------------------------
> - for hire: mac osx device driver ninja, kernel extensions and usb drivers
> ---------------------+------------+---------------------------------------
> http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
> ---------------------+------------+---------------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>



-- 
Best regards,
Dmitry Demeshchuk



More information about the erlang-questions mailing list