Include command error traceback for admins

This commit is contained in:
Tulir Asokan
2018-12-23 20:24:05 +02:00
parent dad0ccb3c0
commit 55f7cbb1bb
+8 -1
View File
@@ -15,9 +15,11 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import Awaitable, Callable, Dict, List, NamedTuple, Optional
import commonmark
import traceback
import logging
import commonmark
from telethon.errors import FloodWaitError
from ..types import MatrixRoomID
@@ -194,6 +196,11 @@ class CommandProcessor:
except Exception:
self.log.exception("Unhandled error while handling command "
f"{evt.command} {' '.join(args)} from {sender.mxid}")
if evt.sender.is_admin and evt.is_management:
return await evt.reply("Unhandled error while handling command:\n\n"
"```traceback\n"
f"{traceback.format_exc()}"
"```")
return await evt.reply("Unhandled error while handling command. "
"Check logs for more details.")
return None