Skip to content

Commit

Permalink
Merge pull request #182 from novaframework/fix-badmatch
Browse files Browse the repository at this point in the history
fix badmatch
  • Loading branch information
Taure committed Apr 18, 2022
2 parents 436cc57 + 80b9140 commit 87aa2d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/nova_error_controller.erl
Expand Up @@ -9,7 +9,7 @@ not_found(Req) ->
case cowboy_req:header(<<"accept">>, Req) of
<<"application/json">> ->
%% Render a json response
{ok, JsonLib} = nova:get_env(json_lib, thoas),
JsonLib = nova:get_env(json_lib, thoas),
Json = erlang:apply(JsonLib, encode, [#{message => "Resource not found"}]),
{status, 404, #{<<"content-type">> => <<"application/json">>}, Json};
_ ->
Expand Down Expand Up @@ -53,7 +53,7 @@ server_error(#{crash_info := #{stacktrace := Stacktrace, class := Class, reason
%% We do show a proper error response
case cowboy_req:header(<<"accept">>, Req) of
<<"application/json">> ->
{ok, JsonLib} = nova:get_env(json_lib, thoas),
JsonLib = nova:get_env(json_lib, thoas),
Json = erlang:apply(JsonLib, encode, [Variables]),
{status, 500, #{<<"content-type">> => <<"application/json">>}, Json};
_ ->
Expand Down

0 comments on commit 87aa2d8

Please sign in to comment.