[erlang-questions] How to the a ets table is exists or not ?

andrey-google buricchio@REDACTED
Sat Mar 15 19:59:56 CET 2008


You may use try..catch
...
try
  ;;do_something with ets table, e.g. ets:update_counter
  ets:update_counter(mytable, mycounter, 1)
  catch
    error:badarg -> init_mytables()
  end.
...
or more specific catch
...
case (catch ets:update_counter(mytable, mycounter, 1)) of
                {'EXIT', {badarg, ...}} ->
...
Cheers!
  







More information about the erlang-questions mailing list