From 2896b721ff35b7507bbbe1c098790b76b53eeb82 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 3 Mar 2020 14:47:47 -0800 Subject: [PATCH] ircd::m::typing: Handle and log exceptions in timeout worker stack. --- matrix/typing.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/matrix/typing.cc b/matrix/typing.cc index 399d910cc..065ca713a 100644 --- a/matrix/typing.cc +++ b/matrix/typing.cc @@ -356,6 +356,7 @@ timeout_worker() bool timeout_check() +try { const auto now { @@ -375,9 +376,20 @@ timeout_check() return false; } +catch(const std::exception &e) +{ + log::critical + { + typing_log, "Typing timeout check :%s", + e.what(), + }; + + return false; +} void timeout_timeout(const typist &t) +try { assert(run::level == run::level::RUN); @@ -403,6 +415,16 @@ timeout_timeout(const typist &t) // sent to clients to stop the typing for this timed out user. _handle_edu_m_typing(event, edu); } +catch(const std::exception &e) +{ + log::error + { + typing_log, "Typing timeout for %s in %s :%s", + string_view{t.user_id}, + string_view{t.room_id}, + e.what(), + }; +} // // internal