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

Required helping method to check if error is a 5XX error #3698

Closed
2 tasks done
vishuvenu opened this issue Dec 4, 2024 · 1 comment
Closed
2 tasks done

Required helping method to check if error is a 5XX error #3698

vishuvenu opened this issue Dec 4, 2024 · 1 comment
Labels
needs-triage Indicates an issue or PR lacks a `triage: foo` label and requires one.

Comments

@vishuvenu
Copy link

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the library and it is still present.

cloudflare-go version

0.111.0

Go environment

NA

Expected output

time="2024-03-13T18:13:38Z" level=error msg="received internal server error response (HTTP 500), please try again later"

Actual output

time="2024-03-13T18:13:38Z" level=fatal msg="received internal server error response (HTTP 500), please try again later"
Stream closed EOF for external-dns/external-dns-cloudflare-205ef5f2-6977ccb67d-kh76q (external-dns)

Code demonstrating the issue

We want to have a simple method to identify the error type

	zonesResponse, err := p.Client.ListZonesContext(ctx)
	if err != nil {
		var apiErr *cloudflare.Error
		if errors.As(err, &apiErr) {
			if apiErr.ServerErrored(err) {
				// Pass any 5XX errors as SoftError
				return nil, provider.NewSoftError(err)
			}
		}
		return nil, err
	}

Steps to reproduce

NA

References

We see few fatal errors when we use Cloudflare as the provider with External-DNS

kubernetes-sigs/external-dns#4315

@vishuvenu vishuvenu added the needs-triage Indicates an issue or PR lacks a `triage: foo` label and requires one. label Dec 4, 2024
@jacobbednarz jacobbednarz closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Indicates an issue or PR lacks a `triage: foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

2 participants