From ddf70d60df8898d6da6a306d8ab3f0a6a82d64dd Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Tue, 17 Nov 2015 00:12:20 +0100 Subject: [PATCH] mod_http_upload: Return error atoms, not strings Don't convert error atoms to strings before actually logging them. This avoids a bogus error message when a user who has no uploaded files is removed. --- mod_http_upload/src/mod_http_upload.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mod_http_upload/src/mod_http_upload.erl b/mod_http_upload/src/mod_http_upload.erl index 1d1e180..0a6074b 100644 --- a/mod_http_upload/src/mod_http_upload.erl +++ b/mod_http_upload/src/mod_http_upload.erl @@ -391,7 +391,7 @@ process([_UserDir, _RandDir, _FileName] = Slot, http_response(Host, 201, Headers, OutData); {error, Error} -> ?ERROR_MSG("Cannot store file ~s from ~s for ~s: ~p", - [Path, ?ADDR_TO_STR(IP), Host, Error]), + [Path, ?ADDR_TO_STR(IP), Host, ?FORMAT(Error)]), http_response(Host, 500) end; {ok, Size, Path} -> @@ -812,7 +812,7 @@ do_store_file(Path, Data, FileMode, DirMode) -> ok = Ok % Raise an exception if file:write/2 failed. catch _:{badmatch, {error, Error}} -> - {error, ?FORMAT(Error)}; + {error, Error}; _:Error -> {error, Error} end. @@ -959,7 +959,7 @@ remove_user(User, Server) -> ?DEBUG("Found no HTTP upload directory of ~s@~s", [User, Server]); {error, Error} -> ?ERROR_MSG("Cannot remove HTTP upload directory of ~s@~s: ~p", - [User, Server, Error]) + [User, Server, ?FORMAT(Error)]) end, ok. @@ -981,7 +981,7 @@ del_tree(Dir) -> ok = file:del_dir(Dir) catch _:{badmatch, {error, Error}} -> - {error, ?FORMAT(Error)}; + {error, Error}; _:Error -> {error, Error} end.