Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PORKBUN: catch error on parsing api #3012

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions providers/porkbun/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ func (c *porkbunProvider) getRecords(domain string) ([]domainRecord, error) {
}

var dr recordResponse
json.Unmarshal(bodyString, &dr)
err = json.Unmarshal(bodyString, &dr)
if err != nil {
return nil, fmt.Errorf("failed parsing record list from porkbun: %w", err)
}

var records []domainRecord
for _, rec := range dr.Records {
Expand All @@ -154,7 +157,10 @@ func (c *porkbunProvider) getNameservers(domain string) ([]string, error) {
}

var ns nsResponse
json.Unmarshal(bodyString, &ns)
err = json.Unmarshal(bodyString, &ns)
if err != nil {
return nil, fmt.Errorf("failed parsing nameserver list from porkbun: %w", err)
}

sort.Strings(ns.Nameservers)

Expand Down Expand Up @@ -185,7 +191,10 @@ func (c *porkbunProvider) listAllDomains() ([]string, error) {
}

var dlr domainListResponse
json.Unmarshal(bodyString, &dlr)
err = json.Unmarshal(bodyString, &dlr)
if err != nil {
return nil, fmt.Errorf("failed parsing domain list from porkbun: %w", err)
}

var domains []string
for _, domain := range dlr.Domains {
Expand Down