mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd:Ⓜ️:room::auth: Improve error hierarchy.
This commit is contained in:
parent
7e8d8666ff
commit
5e87a2e941
2 changed files with 9 additions and 0 deletions
|
@ -21,6 +21,7 @@ struct ircd::m::room::auth
|
|||
using types = vector_view<const string_view>;
|
||||
using events_view = vector_view<const event *>;
|
||||
using passfail = std::tuple<bool, std::exception_ptr>;
|
||||
IRCD_M_EXCEPTION(m::error, error, http::INTERNAL_SERVER_ERROR)
|
||||
IRCD_M_EXCEPTION(error, FAIL, http::UNAUTHORIZED)
|
||||
|
||||
static bool is_power_event(const event &);
|
||||
|
|
|
@ -161,6 +161,7 @@ ircd::m::room::auth::passfail
|
|||
IRCD_MODULE_EXPORT
|
||||
ircd::m::room::auth::check(std::nothrow_t,
|
||||
const event &event)
|
||||
try
|
||||
{
|
||||
using json::at;
|
||||
|
||||
|
@ -244,6 +245,13 @@ ircd::m::room::auth::check(std::nothrow_t,
|
|||
|
||||
return ret;
|
||||
}
|
||||
catch(const std::exception &)
|
||||
{
|
||||
return
|
||||
{
|
||||
false, std::current_exception()
|
||||
};
|
||||
}
|
||||
|
||||
ircd::m::room::auth::passfail
|
||||
IRCD_MODULE_EXPORT
|
||||
|
|
Loading…
Reference in a new issue