Skip to content

Commit

Permalink
Ensure that an error page is rendered on an undefined function except…
Browse files Browse the repository at this point in the history
…ion (#34)

* Ensure that an error page is rendered on an undefined function exception

* Pass reason, remove hard coded 'undef'
  • Loading branch information
mworrell authored May 6, 2022
1 parent 4701845 commit 072e1c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cowmachine.erl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
%% @author Marc Worrell <[email protected]>
%% @copyright 2016-2019 Marc Worrell
%% @copyright 2016-2022 Marc Worrell
%%
%% @doc Cowmachine: webmachine middleware for Cowboy/Zotonic

%% Copyright 2016-2019 Marc Worrell
%% Copyright 2016-2022 Marc Worrell
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -115,7 +115,7 @@ request_1(Controller, Req, Env, Options, Context) ->
log(#{ at => ?AT, level => error, code => 500, text => "Unexpected exception",
class => Class, reason => Reason,
stack => Stacktrace}, Req),
{stop, cowboy_req:reply(500, Req)}
handle_stop_request(500, Site, {throw, {Reason, Stacktrace}}, Req, Env, State, Context)
end.

% @todo add the error controller as an application env, if not defined then just terminate with the corresponding error code.
Expand Down

0 comments on commit 072e1c5

Please sign in to comment.