fix: stop logging errors on cancel in notifier (#15186)

fixes https://github.com/coder/internal/issues/121

We shouldn't log errors when context is canceled, e.g. on shutdown.  This breaks our tests and alarms customers needlessly.
This commit is contained in:
Spike Curtis
2024-10-25 16:28:54 +04:00
committed by GitHub
parent 5bcaa93198
commit d9f1aafa94
2 changed files with 24 additions and 8 deletions
-4
View File
@@ -7,19 +7,15 @@ import (
"text/template"
"golang.org/x/xerrors"
"cdr.dev/slog"
)
func (n *notifier) fetchHelpers(ctx context.Context) (map[string]any, error) {
appName, err := n.fetchAppName(ctx)
if err != nil {
n.log.Error(ctx, "failed to fetch app name", slog.Error(err))
return nil, xerrors.Errorf("fetch app name: %w", err)
}
logoURL, err := n.fetchLogoURL(ctx)
if err != nil {
n.log.Error(ctx, "failed to fetch logo URL", slog.Error(err))
return nil, xerrors.Errorf("fetch logo URL: %w", err)
}