[erlang-questions] is empty catch statement possible?
Thu Feb 9 20:06:56 CET 2012
1. Yes, except that your code will return your Expr wrapped in zero arity fun, which is probably not what you want, though I'm not sure.
2. You can omit 'catch' clause entirely, leaving only 'try' and 'after'.
09.02.2012, 22:37, "Motiejus Jakštys" <>:
> consider this macro:
> -define(silent(Level, Expr), (fun() ->
> __Lager_OldLevel = lager:get_loglevel(lager_console_backend),
> fun() -> Expr end
> throw:'$__should_never_be_thrown' -> ok
> leger:set_loglevel(lager_console_backend, __Lager_OldLevel)
> 1) does it do what I expect? I want log level to be restored in _any_ case.
> 2) Is there a way to avoid the stub throw:Atom statement?
> erlang-questions mailing list
More information about the erlang-questions