~netlandish/links-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH links] Add a bot check to avoid annoying error emails.

Details
Message ID
<20250307213712.1907-1-peter@netlandish.com>
Sender timestamp
1741361827
DKIM signature
missing
Download raw message
Patch: +14 -3
---
 client.go | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/client.go b/client.go
index ed5e7e2..3bc6a68 100644
--- a/client.go
+++ b/client.go
@@ -4,6 +4,7 @@ import (
	"context"
	"fmt"
	"net/http"
	"strings"
	"time"

	"git.sr.ht/~emersion/gqlclient"
@@ -80,9 +81,19 @@ func Execute(ctx context.Context, op *gqlclient.Operation, result interface{}) e

	client = gqlclient.New(origin, httpClient)
	err := client.Execute(ctx, op, &result)
	if graphErrors, ok := err.(interface{ Unwrap() []error }); ok {
		errs := graphErrors.Unwrap()
		err = errs[0]
	if err != nil {
		if graphErrors, ok := err.(interface{ Unwrap() []error }); ok {
			errs := graphErrors.Unwrap()
			err = errs[0]
		} else {
			estr := err.Error()
			if strings.HasPrefix(estr, "HTTP request failed:") &&
				strings.HasSuffix(estr, "context canceled") {
				// Stupid f'n bots. Return this because gobwebs will not send an error email
				// for this error
				return context.Canceled
			}
		}
	}
	return err
}
-- 
2.47.2
Details
Message ID
<D8AD1FIRXQ25.ZTX83WUAGZ7F@netlandish.com>
In-Reply-To
<20250307213712.1907-1-peter@netlandish.com> (view parent)
Sender timestamp
1741362203
DKIM signature
missing
Download raw message
Applied.

To git@git.code.netlandish.com:~netlandish/links
   5851060..dc68fa3  master -> master
Reply to thread Export thread (mbox)