diff --git a/src/statsderl_pool.erl b/src/statsderl_pool.erl index 57bc83a..81110ad 100644 --- a/src/statsderl_pool.erl +++ b/src/statsderl_pool.erl @@ -56,22 +56,28 @@ sample_scaled(RateInt, Operation) -> atom(). server_name(N) -> - case statsderl_pool_foil:lookup(N) of + try statsderl_pool_foil:lookup(N) of {ok, Value} -> Value; {error, _Reason} -> undefined + catch + error:undef -> + undefined end. -spec size() -> pool_size(). size() -> - case statsderl_pool_foil:lookup(pool_size) of + try foil:lookup(?MODULE, pool_size) of {ok, Value} -> Value; {error, _Reason} -> - undefined + 1 + catch + error:undef -> + 1 end. %% private