mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
modules/m_presence: Basic exception handling for the edu hook.
This commit is contained in:
parent
4ee21dba48
commit
0504962248
1 changed files with 25 additions and 0 deletions
|
@ -47,6 +47,7 @@ _m_presence_eval
|
|||
|
||||
void
|
||||
handle_edu_m_presence(const m::event &event)
|
||||
try
|
||||
{
|
||||
if(m::my_host(at<"origin"_>(event)))
|
||||
return;
|
||||
|
@ -64,10 +65,24 @@ handle_edu_m_presence(const m::event &event)
|
|||
for(const json::object &presence : push)
|
||||
handle_edu_m_presence_(event, presence);
|
||||
}
|
||||
catch(const ctx::interrupted &)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
log::error
|
||||
{
|
||||
"Presence from %s :%s",
|
||||
json::get<"origin"_>(event),
|
||||
e.what(),
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
handle_edu_m_presence_(const m::event &event,
|
||||
const m::edu::m_presence &object)
|
||||
try
|
||||
{
|
||||
const m::user::id &user_id
|
||||
{
|
||||
|
@ -107,3 +122,13 @@ handle_edu_m_presence_(const m::event &event,
|
|||
json::get<"last_active_ago"_>(object) / 1000L
|
||||
};
|
||||
}
|
||||
catch(const m::error &e)
|
||||
{
|
||||
log::error
|
||||
{
|
||||
"Presence from %s :%s :%s",
|
||||
json::get<"origin"_>(event),
|
||||
e.what(),
|
||||
e.content
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue