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.
This commit is contained in:
Holger Weiss 2015-11-17 00:12:20 +01:00
parent 53d72bd85a
commit 43626f5c97
1 changed files with 4 additions and 4 deletions

View File

@ -409,7 +409,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} ->
@ -830,7 +830,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.
@ -977,7 +977,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.
@ -999,7 +999,7 @@ del_tree(Dir) ->
ok = file:del_dir(Dir)
catch
_:{badmatch, {error, Error}} ->
{error, ?FORMAT(Error)};
{error, Error};
_:Error ->
{error, Error}
end.