aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/sentryintegration.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-04-04 14:32:40 +0200
committerGitHub Enterprise <[email protected]>2024-04-04 14:32:40 +0200
commit12b7bf1c16f671c83840961c37a339141a7ffbb3 (patch)
tree3c503e6e1cd4d53b87c1baebcf9286ca8b72db06 /src/zenserver/sentryintegration.cpp
parenthardening parsepackagemessage (#38) (diff)
downloadzen-12b7bf1c16f671c83840961c37a339141a7ffbb3.tar.xz
zen-12b7bf1c16f671c83840961c37a339141a7ffbb3.zip
improved assert (#37)
- Improvement: Add file and line to ASSERT exceptions - Improvement: Catch call stack when throwing assert exceptions and log/output call stack at important places to provide more context to caller
Diffstat (limited to 'src/zenserver/sentryintegration.cpp')
-rw-r--r--src/zenserver/sentryintegration.cpp17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/zenserver/sentryintegration.cpp b/src/zenserver/sentryintegration.cpp
index 11bf78a75..a8d967985 100644
--- a/src/zenserver/sentryintegration.cpp
+++ b/src/zenserver/sentryintegration.cpp
@@ -31,13 +31,10 @@ namespace sentry {
struct SentryAssertImpl : zen::AssertImpl
{
- ZEN_FORCENOINLINE ZEN_DEBUG_SECTION SentryAssertImpl();
- virtual ZEN_FORCENOINLINE ZEN_DEBUG_SECTION ~SentryAssertImpl();
virtual void ZEN_FORCENOINLINE ZEN_DEBUG_SECTION OnAssert(const char* Filename,
int LineNumber,
const char* FunctionName,
const char* Msg) override;
- AssertImpl* PrevAssertImpl;
};
class sentry_sink final : public spdlog::sinks::base_sink<spdlog::details::null_mutex>
@@ -85,7 +82,7 @@ sentry_sink::sink_it_(const spdlog::details::log_msg& msg)
sentry_event_value_add_stacktrace(event, NULL, 0);
sentry_capture_event(event);
}
- catch (std::exception&)
+ catch (const std::exception&)
{
// If our logging with Message formatting fails we do a non-allocating version and just post the msg.payload raw
char TmpBuffer[256];
@@ -105,16 +102,6 @@ sentry_sink::flush_()
{
}
-SentryAssertImpl::SentryAssertImpl() : PrevAssertImpl(CurrentAssertImpl)
-{
- CurrentAssertImpl = this;
-}
-
-SentryAssertImpl::~SentryAssertImpl()
-{
- CurrentAssertImpl = PrevAssertImpl;
-}
-
void
SentryAssertImpl::OnAssert(const char* Filename, int LineNumber, const char* FunctionName, const char* Msg)
{
@@ -128,7 +115,7 @@ SentryAssertImpl::OnAssert(const char* Filename, int LineNumber, const char* Fun
sentry_event_value_add_stacktrace(event, NULL, 0);
sentry_capture_event(event);
}
- catch (std::exception&)
+ catch (const std::exception&)
{
// If our logging with Message formatting fails we do a non-allocating version and just post the Msg raw
sentry_value_t event = sentry_value_new_message_event(