From acd1befde66db492149992199fadca92e55cc97b Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Thu, 6 Apr 2023 21:43:29 -0400 Subject: sentry: Add sentry support Change-Id: I3cff2a05c63e88abddc8eff6a3ee9a9f73a5172d --- include/142bot/bot.hpp | 2 +- include/142bot/modules.hpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/142bot/bot.hpp b/include/142bot/bot.hpp index a422416..165515f 100644 --- a/include/142bot/bot.hpp +++ b/include/142bot/bot.hpp @@ -9,12 +9,12 @@ class Module; class ModuleLoader; class Bot { - pqxx::connection conn; bool dev; dpp::snowflake owner_id; private: bool run_database_migrations(); public: + pqxx::connection conn; class dpp::cluster * core; /* The bot's user from the ready event */ dpp::user user; diff --git a/include/142bot/modules.hpp b/include/142bot/modules.hpp index 3af0253..c0aad32 100644 --- a/include/142bot/modules.hpp +++ b/include/142bot/modules.hpp @@ -8,6 +8,7 @@ #pragma once #include "bot.hpp" +#include class ModuleLoader; class Module; @@ -77,10 +78,16 @@ enum Events list_to_call = loader->EventHandlers[y]; \ break; \ } \ + sentry_remove_tag("module"); \ } \ catch (std::exception& modexcept) \ { \ core->log(dpp::ll_error, fmt::format("Exception caught in module: {}", modexcept.what())); \ + sentry_value_t event = sentry_value_new_event(); \ + sentry_value_t exc = sentry_value_new_exception("Exception", modexcept.what()); \ + sentry_value_set_stacktrace(exc, NULL, 0); \ + sentry_event_add_exception(event, exc); \ + sentry_capture_event(event); \ } \ } \ }; -- cgit v1.2.3