0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 00:14:07 +01:00

ircd:Ⓜ️:event: Add parse error reporting on fetch assignments.

This commit is contained in:
Jason Volk 2019-09-15 14:39:36 -07:00
parent fdad8445dc
commit cd952963da

View file

@ -1406,6 +1406,7 @@ ircd::m::event::fetch::fetch(const opts &opts)
bool
ircd::m::event::fetch::assign_from_json(const string_view &key)
try
{
auto &event
{
@ -1444,9 +1445,29 @@ ircd::m::event::fetch::assign_from_json(const string_view &key)
assert(event.event_id == event_id);
return true;
}
catch(const json::parse_error &e)
{
const auto event_id
{
event_id_buf?
id(event_id_buf):
m::event_id(event_idx, event_id_buf, std::nothrow)
};
log::critical
{
m::log, "Fetching event:%lu %s JSON from local database :%s",
event_idx,
string_view{event_id},
e.what(),
};
return false;
}
bool
ircd::m::event::fetch::assign_from_row(const string_view &key)
try
{
auto &event
{
@ -1471,6 +1492,25 @@ ircd::m::event::fetch::assign_from_row(const string_view &key)
event.event_id = event_id;
return true;
}
catch(const json::parse_error &e)
{
const auto event_id
{
event_id_buf?
id(event_id_buf):
m::event_id(event_idx, event_id_buf, std::nothrow)
};
log::critical
{
m::log, "Fetching event:%lu %s JSON from local database :%s",
event_idx,
string_view{event_id},
e.what(),
};
return false;
}
bool
ircd::m::event::fetch::should_seek_json(const opts &opts)