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:
parent
f2f8fe25f7
commit
ddf70d60df
|
@ -391,7 +391,7 @@ process([_UserDir, _RandDir, _FileName] = Slot,
|
||||||
http_response(Host, 201, Headers, OutData);
|
http_response(Host, 201, Headers, OutData);
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
?ERROR_MSG("Cannot store file ~s from ~s for ~s: ~p",
|
?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)
|
http_response(Host, 500)
|
||||||
end;
|
end;
|
||||||
{ok, Size, Path} ->
|
{ok, Size, Path} ->
|
||||||
|
@ -812,7 +812,7 @@ do_store_file(Path, Data, FileMode, DirMode) ->
|
||||||
ok = Ok % Raise an exception if file:write/2 failed.
|
ok = Ok % Raise an exception if file:write/2 failed.
|
||||||
catch
|
catch
|
||||||
_:{badmatch, {error, Error}} ->
|
_:{badmatch, {error, Error}} ->
|
||||||
{error, ?FORMAT(Error)};
|
{error, Error};
|
||||||
_:Error ->
|
_:Error ->
|
||||||
{error, Error}
|
{error, Error}
|
||||||
end.
|
end.
|
||||||
|
@ -959,7 +959,7 @@ remove_user(User, Server) ->
|
||||||
?DEBUG("Found no HTTP upload directory of ~s@~s", [User, Server]);
|
?DEBUG("Found no HTTP upload directory of ~s@~s", [User, Server]);
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
?ERROR_MSG("Cannot remove HTTP upload directory of ~s@~s: ~p",
|
?ERROR_MSG("Cannot remove HTTP upload directory of ~s@~s: ~p",
|
||||||
[User, Server, Error])
|
[User, Server, ?FORMAT(Error)])
|
||||||
end,
|
end,
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
@ -981,7 +981,7 @@ del_tree(Dir) ->
|
||||||
ok = file:del_dir(Dir)
|
ok = file:del_dir(Dir)
|
||||||
catch
|
catch
|
||||||
_:{badmatch, {error, Error}} ->
|
_:{badmatch, {error, Error}} ->
|
||||||
{error, ?FORMAT(Error)};
|
{error, Error};
|
||||||
_:Error ->
|
_:Error ->
|
||||||
{error, Error}
|
{error, Error}
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue