Skip to content

Commit

Permalink
more elegant not_found handling (no exceptions)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhekkel committed Jan 8, 2024
1 parent ecd1c5a commit d09e3ee
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib-http/src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,19 @@ void basic_server::handle_request(asio_ns::ip::tcp::socket &socket, request &req
}

if (not processed)
throw not_found;
{
for (auto eh : m_error_handlers)
{
try
{
if (eh->create_error_reply(req, not_found, rep))
break;
}
catch (...)
{
}
}
}

if (method == "HEAD" or method == "OPTIONS")
rep.set_content("", rep.get_content_type());
Expand Down

0 comments on commit d09e3ee

Please sign in to comment.