1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Switch to Go 1.13 error wrapping (#604)

* Replaced errors.Wrap with fmt.Errorf (#589)

* Find:    errors\.Wrap\(([^,]+),\s+(["`][^"`]*)(["`])\)
  Replace: fmt.Errorf($2: %w$3, $1)

* Replaced errors.Wrapf with fmt.Errorf (#589)

* Find:    errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])\)
  Replace: fmt.Errorf($2: %w$3, $1)
* Find:    errors\.Wrapf\(([^,]+),\s+(["`][^"`]*)(["`])(,[^)]+)\)
* Replace: fmt.Errorf($2: %w$3$4, $1)

* Replaced errors.Errorf with fmt.Errorf (#589)

* Find:    errors\.Errorf
  Replace: fmt.Errorf

* Cleaned up remaining imports

* Cleanup

* Regenerate provider support matrix

This was broken by #533 ... and it's now the third time this has been missed.
This commit is contained in:
Patrick Gaskin
2020-01-28 11:06:56 -05:00
committed by Tom Limoncelli
parent cae35a2c8f
commit 825ba2d081
64 changed files with 328 additions and 379 deletions

View File

@@ -8,8 +8,6 @@ import (
"strconv"
"strings"
"github.com/pkg/errors"
"github.com/StackExchange/dnscontrol/v2/models"
"github.com/StackExchange/dnscontrol/v2/providers/diff"
)
@@ -121,15 +119,15 @@ func toRecord(r *HXRecord, origin string) *models.RecordConfig {
rc.SetTargetTXTs(decodeTxt(r.Answer))
case "MX":
if err := rc.SetTargetMX(uint16(r.Priority), r.Answer); err != nil {
panic(errors.Wrap(err, "unparsable MX record received from hexonet api"))
panic(fmt.Errorf("unparsable MX record received from hexonet api: %w", err))
}
case "SRV":
if err := rc.SetTargetSRVPriorityString(uint16(r.Priority), r.Answer); err != nil {
panic(errors.Wrap(err, "unparsable SRV record received from hexonet api"))
panic(fmt.Errorf("unparsable SRV record received from hexonet api: %w", err))
}
default: // "A", "AAAA", "ANAME", "CNAME", "NS"
if err := rc.PopulateFromString(rtype, r.Answer, r.Fqdn); err != nil {
panic(errors.Wrap(err, "unparsable record received from hexonet api"))
panic(fmt.Errorf("unparsable record received from hexonet api: %w", err))
}
}
return rc