Disable Sentry if init fails
This will fix other uses of the APi blocking because the backend failed to start. Enable debug logging in non-release builds so it's obvious when the deploymenty is not configured right.
This commit is contained in:
parent
271073d869
commit
5f66ffc96b
1 changed files with 20 additions and 12 deletions
|
@ -279,6 +279,11 @@ void initSentry()
|
|||
const auto buildString = std::to_string(JENKINS_BUILD_NUMBER);
|
||||
sentry_options_set_dist(options, buildString.c_str());
|
||||
|
||||
// for dev / nightly builds, put Sentry in debug mode
|
||||
if (strcmp(FG_BUILD_TYPE, "Release")) {
|
||||
sentry_options_set_debug(options, 1);
|
||||
}
|
||||
|
||||
SGPath dataPath = fgHomePath() / "sentry_db";
|
||||
#if defined(SG_WINDOWS)
|
||||
const auto homePathString = dataPath.wstr();
|
||||
|
@ -320,9 +325,8 @@ void initSentry()
|
|||
f << uuid << endl;
|
||||
}
|
||||
|
||||
sentry_init(options);
|
||||
if (sentry_init(options) == 0) {
|
||||
static_sentryEnabled = true;
|
||||
|
||||
sentry_value_t user = sentry_value_new_object();
|
||||
sentry_value_t userUuidV = sentry_value_new_string(uuid.c_str());
|
||||
sentry_value_set_by_key(user, "id", userUuidV);
|
||||
|
@ -333,6 +337,10 @@ void initSentry()
|
|||
simgear::setErrorReportCallback(sentrySimgearReportCallback);
|
||||
|
||||
std::set_new_handler(sentryReportBadAlloc);
|
||||
} else {
|
||||
SG_LOG(SG_GENERAL, SG_WARN, "Failed to init Sentry reporting");
|
||||
static_sentryEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void delayedSentryInit()
|
||||
|
|
Loading…
Reference in a new issue