Permalink
Browse files

WHISTLE-42: ignore webseq server if opening file fails

  • Loading branch information...
James Aimonetti
James Aimonetti committed Feb 6, 2013
1 parent 5058997 commit a5ac89c1dc46808312e801c54f7ca27bcf44c155
Showing with 12 additions and 5 deletions.
  1. +12 −5 whistle_apps/apps/acdc/src/webseq.erl
@@ -81,11 +81,18 @@ what(IO) when is_list(IO) -> iolist_to_binary(IO).
init(_) ->
_ = file:rename(?WEBSEQNAME, iolist_to_binary([?WEBSEQNAME, ".", wh_util:to_binary(wh_util:current_tstamp())])),
- {ok, IO} = file:open(?WEBSEQNAME, [append, raw, delayed_write]),
- {ok, #state{io_device=IO
- ,who_registry=dict:new()
- }}.
-
+ case file:open(?WEBSEQNAME, ['append', 'raw', 'delayed_write']) of
+ {'ok', IO} ->
+ {'ok', #state{io_device=IO
+ ,who_registry=dict:new()
+ }};
+ {'error', 'eaccess'} ->
+ lager:info("failed to open ~s, eaccess error - check permissions", [?WEBSEQNAME]),
+ 'ignore';
+ {'error', _E} ->
+ lager:info("failed to open ~s, error: ~s", [?WEBSEQNAME, _E]),
+ 'ignore'
+ end.
handle_call({who, P}, _, #state{who_registry=Who}=State) when is_pid(P) ->
PBin = wh_util:to_binary(pid_to_list(P)),

0 comments on commit a5ac89c

Please sign in to comment.