0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-13 08:23:56 +01:00

ircd:Ⓜ️:room: Improve error strings for room_id() resolve interface.

This commit is contained in:
Jason Volk 2020-06-11 05:42:47 -07:00
parent 39e777e88f
commit cb2b92b241

View file

@ -410,6 +410,7 @@ ircd::m::room_id(const mutable_buffer &out,
ircd::m::id::room
ircd::m::room_id(const mutable_buffer &out,
const event::idx &event_idx)
try
{
room::id ret;
m::get(event_idx, "room_id", [&out, &ret]
@ -420,10 +421,19 @@ ircd::m::room_id(const mutable_buffer &out,
return ret;
}
catch(const m::NOT_FOUND &e)
{
throw m::NOT_FOUND
{
"resolving room_id from event_idx :%s",
e.what(),
};
}
ircd::m::id::room
ircd::m::room_id(const mutable_buffer &out,
const id::event &event_id)
try
{
room::id ret;
m::get(event_id, "room_id", [&out, &ret]
@ -434,10 +444,19 @@ ircd::m::room_id(const mutable_buffer &out,
return ret;
}
catch(const m::NOT_FOUND &e)
{
throw m::NOT_FOUND
{
"resolving room_id from event_id :%s",
e.what(),
};
}
ircd::m::id::room
ircd::m::room_id(const mutable_buffer &out,
const id::room_alias &room_alias)
try
{
room::id ret;
room::aliases::cache::get(room_alias, [&out, &ret]
@ -448,6 +467,14 @@ ircd::m::room_id(const mutable_buffer &out,
return ret;
}
catch(const m::NOT_FOUND &e)
{
throw m::NOT_FOUND
{
"resolving room_id from alias :%s",
e.what(),
};
}
bool
ircd::m::exists(const id::room_alias &room_alias,