等到 Sentry 发送错误报告后再退出应用程序

Wait until Sentry sent the error report before exiting the application

我正在使用 Sentry 从我的桌面应用程序报告错误。我 运行 遇到的一个问题是,如果异常导致应用程序崩溃,它似乎永远无法到达哨兵服务器。从调试 Sentry 本身来看,异常似乎被放置在缓冲区中供以后发送,但在这种特殊情况下,我需要它们同步发送。

我该怎么做?

我正在报告这样的例外情况:

Sentry.capture(e);

Sentry 暴露了一个方法 close which internally calls the closeConnection.

正在查看 BufferedConnection, the code will wait for sometime to let the buffer clear

简而言之:尝试调用:Sentry.close();