From d84e49dd856d12078d2939e02768d22c67cb23ee Mon Sep 17 00:00:00 2001 From: Alexei Tighineanu Date: Sun, 15 Nov 2020 11:10:50 +0100 Subject: [PATCH] Fix for issue https://github.com/containrrr/shoutrrr/issues/71 (#75) --- pkg/services/rocketchat/rocketchat.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/services/rocketchat/rocketchat.go b/pkg/services/rocketchat/rocketchat.go index 88e3edc7..ff121be6 100644 --- a/pkg/services/rocketchat/rocketchat.go +++ b/pkg/services/rocketchat/rocketchat.go @@ -34,7 +34,9 @@ func (service *Service) Send(message string, params *types.Params) error { apiURL := buildURL(config) json, _ := CreateJSONPayload(config, message, params) res, err := http.Post(apiURL, "application/json", bytes.NewReader(json)) - + if err != nil { + return fmt.Errorf("Error while posting to URL: %v", err) + } if res.StatusCode != http.StatusOK { return fmt.Errorf("failed to send notification to service, response status code %s", res.Status) } @@ -44,4 +46,3 @@ func (service *Service) Send(message string, params *types.Params) error { func buildURL(config *Config) string { return fmt.Sprintf("https://%s/hooks/%s/%s", config.Host, config.TokenA, config.TokenB) } -