From 16d8bd54d378802a5994cd20616a6af006432073 Mon Sep 17 00:00:00 2001 From: libmartinito Date: Wed, 29 May 2024 22:47:36 +0800 Subject: [PATCH] feat: Add monitoring for unexpected build status --- internal/utils/codecrafters_client.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/utils/codecrafters_client.go b/internal/utils/codecrafters_client.go index e31588a..d210ff6 100644 --- a/internal/utils/codecrafters_client.go +++ b/internal/utils/codecrafters_client.go @@ -8,6 +8,7 @@ import ( "time" retry "github.com/avast/retry-go" + "github.com/getsentry/sentry-go" "github.com/levigross/grequests" "github.com/mitchellh/go-wordwrap" ) @@ -190,7 +191,10 @@ func (c CodecraftersClient) FetchBuild(buildId string) (FetchBuildStatusResponse } if fetchBuildResponse.Status != "failure" && fetchBuildResponse.Status != "success" { - return fmt.Errorf("unexpected build status: %s", fetchBuildResponse.Status) + err = fmt.Errorf("unexpected build status: %s", fetchBuildResponse.Status) + + sentry.CaptureException(err) + return err } return nil