0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

ircd: Tweak client error handling; fwddecl json::expectation_failure.

This commit is contained in:
Jason Volk 2018-03-08 07:40:41 -08:00
parent 4dd97298f5
commit 8c02823d49
4 changed files with 11 additions and 11 deletions

View file

@ -21,6 +21,7 @@ namespace ircd::json
IRCD_EXCEPTION(error, type_error); IRCD_EXCEPTION(error, type_error);
IRCD_EXCEPTION(error, not_found); IRCD_EXCEPTION(error, not_found);
IRCD_EXCEPTION(parse_error, recursion_limit); IRCD_EXCEPTION(parse_error, recursion_limit);
struct expectation_failure;
struct value; struct value;
struct member; struct member;

View file

@ -572,18 +572,19 @@ catch(const boost::system::system_error &e)
close(net::dc::RST, net::close_ignore); close(net::dc::RST, net::close_ignore);
return false; return false;
} }
#ifndef RB_DEBUG
catch(const std::exception &e) catch(const std::exception &e)
{ {
log::error("client[%s] [500 Internal Error]: %s", log::error
{
"client[%s] [500 Internal Error]: %s"
string(remote(*this)), string(remote(*this)),
e.what()); e.what())
};
#ifdef RB_DEBUG
throw;
#else
return false; return false;
#endif
} }
#endif
/// Handle a single request within the client main() loop. /// Handle a single request within the client main() loop.
/// ///

View file

@ -42,8 +42,6 @@ namespace ircd::json
using karma::eps; using karma::eps;
using karma::attr_cast; using karma::attr_cast;
struct expectation_failure;
template<class it> struct input; template<class it> struct input;
template<class it> struct output; template<class it> struct output;

View file

@ -321,7 +321,7 @@ catch(const json::not_found &e)
{ {
throw m::error throw m::error
{ {
http::BAD_REQUEST, "M_BAD_JSON", "Required JSON field: %s", e.what() http::NOT_FOUND, "M_BAD_JSON", "Required JSON field: %s", e.what()
}; };
} }
catch(const json::print_error &e) catch(const json::print_error &e)