From 0397f69853bf3f8ed325adb4a482ea149bafbdcb Mon Sep 17 00:00:00 2001 From: yusing Date: Wed, 30 Oct 2024 06:44:10 +0800 Subject: [PATCH] fixed notification not being sent --- Makefile | 6 +++--- internal/error/subject.go | 2 ++ internal/notif/dispatcher.go | 2 +- internal/notif/gotify.go | 2 -- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3561f958..61876796 100755 --- a/Makefile +++ b/Makefile @@ -29,15 +29,15 @@ get: debug: make build - GOPROXY_DEBUG=1 sudo bin/go-proxy + sudo GOPROXY_DEBUG=1 bin/go-proxy debug-trace: make build - GOPROXY_DEBUG=1 GOPROXY_TRACE=1 sudo bin/go-proxy + sudo GOPROXY_DEBUG=1 GOPROXY_TRACE=1 bin/go-proxy profile: GODEBUG=gctrace=1 make build - GOPROXY_DEBUG=1 sudo bin/go-proxy + sudo GOPROXY_DEBUG=1 bin/go-proxy mtrace: bin/go-proxy debug-ls-mtrace > mtrace.json diff --git a/internal/error/subject.go b/internal/error/subject.go index 0c5ffef3..e1461392 100644 --- a/internal/error/subject.go +++ b/internal/error/subject.go @@ -19,6 +19,8 @@ func highlight(subject string) string { func PrependSubject(subject string, err error) error { switch err := err.(type) { + case nil: + return nil case *withSubject: return err.Prepend(subject) case Error: diff --git a/internal/notif/dispatcher.go b/internal/notif/dispatcher.go index fed2c9a4..79dcc824 100644 --- a/internal/notif/dispatcher.go +++ b/internal/notif/dispatcher.go @@ -90,7 +90,7 @@ func (disp *Dispatcher) dispatch(msg *LogMessage) { if errs.HasError() { E.LogError(errs.About(), errs.Error()) } else { - logging.Debug().Msgf("dispatched notif: %s", msg.Message) + logging.Debug().Str("title", msg.Title).Str("message", msg.Message).Msgf("dispatched notif") } } diff --git a/internal/notif/gotify.go b/internal/notif/gotify.go index 90c9e018..0e5de668 100644 --- a/internal/notif/gotify.go +++ b/internal/notif/gotify.go @@ -62,8 +62,6 @@ func (client *GotifyClient) Send(ctx context.Context, logMsg *LogMessage) error priority = 5 case zerolog.FatalLevel, zerolog.PanicLevel: priority = 8 - default: - return nil } msg := &GotifyMessage{