From 1697697b8107c38b41a51bded53bae78efd60ab1 Mon Sep 17 00:00:00 2001 From: Quentin McGaw Date: Fri, 9 Feb 2024 10:00:13 +0000 Subject: [PATCH] chore(porkbun): add context to top level errors --- internal/provider/providers/porkbun/provider.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/provider/providers/porkbun/provider.go b/internal/provider/providers/porkbun/provider.go index a06aa65b7..59bc7d5b8 100644 --- a/internal/provider/providers/porkbun/provider.go +++ b/internal/provider/providers/porkbun/provider.go @@ -115,19 +115,19 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add ipStr := ip.String() recordIDs, err := p.getRecordIDs(ctx, client, recordType) if err != nil { - return netip.Addr{}, err + return netip.Addr{}, fmt.Errorf("getting record IDs: %w", err) } if len(recordIDs) == 0 { // ALIAS record needs to be deleted to allow creating an A record. err = p.deleteALIASRecordIfNeeded(ctx, client) if err != nil { - return netip.Addr{}, err + return netip.Addr{}, fmt.Errorf("deleting ALIAS record if needed: %w", err) } err = p.createRecord(ctx, client, recordType, ipStr) if err != nil { - return netip.Addr{}, err + return netip.Addr{}, fmt.Errorf("creating record: %w", err) } return ip, nil } @@ -135,7 +135,7 @@ func (p *Provider) Update(ctx context.Context, client *http.Client, ip netip.Add for _, recordID := range recordIDs { err = p.updateRecord(ctx, client, recordType, ipStr, recordID) if err != nil { - return netip.Addr{}, err + return netip.Addr{}, fmt.Errorf("updating record: %w", err) } }