aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2018-10-19 10:30:05 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2018-10-19 10:30:05 +0200
commit5181983d97dbbfc5dbf159f8cc5ee6985ed6a10f (patch)
treef86edc4dc0fc1c39073031ebb526b8b445f503bd /src
parentUpdate p1_mysql (diff)
Recognize not_exists error in http_api
Diffstat (limited to 'src')
-rw-r--r--src/mod_http_api.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mod_http_api.erl b/src/mod_http_api.erl
index 84866d4d0..3bea1437d 100644
--- a/src/mod_http_api.erl
+++ b/src/mod_http_api.erl
@@ -301,9 +301,9 @@ handle(Call, Auth, Args, Version) when is_atom(Call), is_list(Args) ->
throw:{not_allowed, Msg} ->
{401, iolist_to_binary(Msg)};
throw:{error, account_unprivileged} ->
- {403, 31, <<"Command need to be run with admin privilege.">>};
- throw:{error, access_rules_unauthorized} ->
- {403, 32, <<"AccessRules: Account does not have the right to perform the operation.">>};
+ {403, 31, <<"Command need to be run with admin privilege.">>};
+ throw:{error, access_rules_unauthorized} ->
+ {403, 32, <<"AccessRules: Account does not have the right to perform the operation.">>};
throw:{invalid_parameter, Msg} ->
{400, iolist_to_binary(Msg)};
throw:{error, Why} when is_atom(Why) ->
@@ -504,6 +504,8 @@ format_result(404, {_Name, _}) ->
format_error_result(conflict, Code, Msg) ->
{409, Code, iolist_to_binary(Msg)};
+format_error_result(not_exists, Code, Msg) ->
+ {404, Code, iolist_to_binary(Msg)};
format_error_result(_ErrorAtom, Code, Msg) ->
{500, Code, iolist_to_binary(Msg)}.