mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd:Ⓜ️ Handle json::not_found on index() for more descriptive error.
This commit is contained in:
parent
6b1fd6c559
commit
5236790228
1 changed files with 13 additions and 0 deletions
|
@ -1391,16 +1391,29 @@ ircd::m::seek(event::fetch &fetch,
|
|||
|
||||
ircd::m::event::idx
|
||||
ircd::m::index(const event &event)
|
||||
try
|
||||
{
|
||||
return index(at<"event_id"_>(event));
|
||||
}
|
||||
catch(const json::not_found &)
|
||||
{
|
||||
throw m::NOT_FOUND
|
||||
{
|
||||
"Cannot find index for event without an event_id."
|
||||
};
|
||||
}
|
||||
|
||||
ircd::m::event::idx
|
||||
ircd::m::index(const event &event,
|
||||
std::nothrow_t)
|
||||
try
|
||||
{
|
||||
return index(at<"event_id"_>(event), std::nothrow);
|
||||
}
|
||||
catch(const json::not_found &)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ircd::m::event::idx
|
||||
ircd::m::index(const event::id &event_id)
|
||||
|
|
Loading…
Reference in a new issue