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:
committed by
Tom Limoncelli
parent
cae35a2c8f
commit
825ba2d081
@@ -3,11 +3,10 @@ package linode
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -23,7 +22,7 @@ func (c *LinodeApi) fetchDomainList() error {
|
||||
dr := &domainResponse{}
|
||||
endpoint := fmt.Sprintf("%s?page=%d", domainsPath, page)
|
||||
if err := c.get(endpoint, dr); err != nil {
|
||||
return errors.Errorf("Error fetching domain list from Linode: %s", err)
|
||||
return fmt.Errorf("Error fetching domain list from Linode: %s", err)
|
||||
}
|
||||
for _, domain := range dr.Data {
|
||||
c.domainIndex[domain.Domain] = domain.ID
|
||||
@@ -43,7 +42,7 @@ func (c *LinodeApi) getRecords(id int) ([]domainRecord, error) {
|
||||
dr := &recordResponse{}
|
||||
endpoint := fmt.Sprintf("%s/%d/records?page=%d", domainsPath, id, page)
|
||||
if err := c.get(endpoint, dr); err != nil {
|
||||
return nil, errors.Errorf("Error fetching record list from Linode: %s", err)
|
||||
return nil, fmt.Errorf("Error fetching record list from Linode: %s", err)
|
||||
}
|
||||
|
||||
records = append(records, dr.Data...)
|
||||
@@ -174,7 +173,7 @@ func (c *LinodeApi) handleErrors(resp *http.Response) error {
|
||||
errs := &errorResponse{}
|
||||
|
||||
if err := decoder.Decode(errs); err != nil {
|
||||
return errors.Errorf("bad status code from Linode: %d not 200. Failed to decode response", resp.StatusCode)
|
||||
return fmt.Errorf("bad status code from Linode: %d not 200. Failed to decode response", resp.StatusCode)
|
||||
}
|
||||
|
||||
buf := bytes.NewBufferString(fmt.Sprintf("bad status code from Linode: %d not 200", resp.StatusCode))
|
||||
|
||||
Reference in New Issue
Block a user