diff options
author | Cara Salter <cara@devcara.com> | 2023-04-06 21:43:29 -0400 |
---|---|---|
committer | Cara Salter <cara@devcara.com> | 2023-04-06 21:43:29 -0400 |
commit | acd1befde66db492149992199fadca92e55cc97b (patch) | |
tree | 16251d96cd8efd5323fa8f095bb29f110030f387 /include | |
parent | 555810bedc0cf9d9d954f56b5a2c8c92522ad27f (diff) | |
download | 142bot-acd1befde66db492149992199fadca92e55cc97b.tar.gz 142bot-acd1befde66db492149992199fadca92e55cc97b.zip |
sentry: Add sentry support
Change-Id: I3cff2a05c63e88abddc8eff6a3ee9a9f73a5172d
Diffstat (limited to 'include')
-rw-r--r-- | include/142bot/bot.hpp | 2 | ||||
-rw-r--r-- | include/142bot/modules.hpp | 7 |
2 files changed, 8 insertions, 1 deletions
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 <sentry.h> 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); \ } \ } \ }; |