mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00
Explanatory comments
This commit is contained in:
parent
32d482edd3
commit
646232dcb0
@ -120,6 +120,9 @@ func main() {
|
||||
AddPrometheusMetrics: args[EnvPrometheus] != "",
|
||||
})
|
||||
|
||||
// Initialise sentry. We do this in a separate block to the sentry code below,
|
||||
// because we want to configure logging before starting the pollers—they may want to
|
||||
// log to sentry themselves.
|
||||
if args[EnvSentryDsn] != "" {
|
||||
fmt.Printf("Configuring Sentry reporter...\n")
|
||||
err := sentry.Init(sentry.ClientOptions{
|
||||
|
@ -84,6 +84,16 @@ func (c *Conn) tryRequest(ctx context.Context, req *Request) (res *Response, err
|
||||
if panicErr != nil {
|
||||
err = fmt.Errorf("panic: %s", panicErr)
|
||||
logger.Error().Msg(string(debug.Stack()))
|
||||
// Note: as we've captured the panicErr ourselves, there isn't much
|
||||
// difference between RecoverWithContext and CaptureException. But
|
||||
// there /is/ a small difference:
|
||||
//
|
||||
// - RecoverWithContext will generate generate an Sentry event marked with
|
||||
// a "RecoveredException" hint
|
||||
// - CaptureException instead uses an "OriginalException" hint.
|
||||
//
|
||||
// I'm guessing that Sentry will use the former to display panicErr as
|
||||
// having come from a panic.
|
||||
internal.GetSentryHubFromContextOrDefault(ctx).RecoverWithContext(ctx, panicErr)
|
||||
} else if err != nil {
|
||||
internal.GetSentryHubFromContextOrDefault(ctx).CaptureException(err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user