davisp commented on a change in pull request #1164: Fix: Proper error handling for file:open() call in couch_file.erl URL: https://github.com/apache/couchdb/pull/1164#discussion_r172540093
########## File path: src/couch/src/couch_file.erl ########## @@ -213,8 +213,12 @@ truncate(Fd, Pos) -> %%---------------------------------------------------------------------- sync(Filepath) when is_list(Filepath) -> - {ok, Fd} = file:open(Filepath, [append, raw]), - try ok = file:sync(Fd) after ok = file:close(Fd) end; + case file:open(Filepath, [append, raw]) of + {ok, Fd} -> + try ok = file:sync(Fd) after ok = file:close(Fd) end; + Error -> + throw(Error) Review comment: Match {error, Error} and then erlang:error(Error) here. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services