diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 871c6a0..2854ab1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,14 +4,12 @@ stages: lint: stage: test - only: ['main'] image: registry.gitlab.com/etke.cc/base script: - make lint unit: stage: test - only: ['main'] image: registry.gitlab.com/etke.cc/base script: - make test diff --git a/bot/bot.go b/bot/bot.go index 8b2daaa..d9de689 100644 --- a/bot/bot.go +++ b/bot/bot.go @@ -61,10 +61,17 @@ func (b *Bot) Error(ctx context.Context, roomID id.RoomID, message string, args // Notice sends a notice message to the matrix room func (b *Bot) Notice(ctx context.Context, roomID id.RoomID, message string, args ...interface{}) { - b.lp.Send(roomID, &event.MessageEventContent{ + _, err := b.lp.Send(roomID, &event.MessageEventContent{ MsgType: event.MsgNotice, Body: fmt.Sprintf(message, args...), }) + if err != nil { + if sentry.HasHubOnContext(ctx) { + sentry.GetHubFromContext(ctx).CaptureException(err) + } else { + sentry.CaptureException(err) + } + } } // Start performs matrix /sync