lego: export resolver.obtainError?

I got a badNonce during Obtain(). Based on the logs, it looks like it failed before it got confirmation of validation: I see the five badNonce errors after Checking DNS record propagation, but not the The server validated our request message; if I GET the auth URL, it tells me that the status is valid.

Obtain() returns an error that, according to %T, is of type resolver.obtainError. If there’s a way to “cast” this to the underlying map[string]error, I can’t figure it out, which means I can’t get at any of the underlying errors and either report them, store them, act on any data they may contain, etc. In this case, I think I’d be able to assert that the error value in the map is actually an acme.NonceError and retry more (though I don’t think I have access to either the URL I’d need or the routines to operate on it).

The only workaround I can think of is to parse the error string. At least that’s fairly nicely structured, but it’s still kinda gross.

Can resolver.obtainError be made public? That should be non-breaking, yes? Are there other errors that might be useful, as well?

I guess what I’m really looking for is a way for lego to tell me that although it failed, the operation is retryable (the failure isn’t terminal), and to give me a way to retry it from whatever point it failed. This would take care of #771, too, but is probably a huge change.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (11 by maintainers)

Commits related to this issue

Most upvoted comments

For me, the current obtainError type is still not exportable, this type was created a long time ago, the error system provided by Go has been improved. I think I can create a new type that can be better for lego API consumers.