Enhance documentation about error handling

pull/98/head
Richard Körber 2021-02-10 07:21:59 +01:00
parent 91898ed7d1
commit d5305aae36
No known key found for this signature in database
GPG Key ID: AAB9FD19C78AA3E0
3 changed files with 6 additions and 2 deletions

View File

@ -121,6 +121,7 @@ public class ClientTest {
while (order.getStatus() != Status.VALID && attempts-- > 0) { while (order.getStatus() != Status.VALID && attempts-- > 0) {
// Did the order fail? // Did the order fail?
if (order.getStatus() == Status.INVALID) { if (order.getStatus() == Status.INVALID) {
LOG.error("Order has failed, reason: {}", order.getError());
throw new AcmeException("Order failed... Giving up."); throw new AcmeException("Order failed... Giving up.");
} }
@ -271,6 +272,7 @@ public class ClientTest {
while (challenge.getStatus() != Status.VALID && attempts-- > 0) { while (challenge.getStatus() != Status.VALID && attempts-- > 0) {
// Did the authorization fail? // Did the authorization fail?
if (challenge.getStatus() == Status.INVALID) { if (challenge.getStatus() == Status.INVALID) {
LOG.error("Challenge has failed, reason: {}", challenge.getError());
throw new AcmeException("Challenge failed... Giving up."); throw new AcmeException("Challenge failed... Giving up.");
} }

View File

@ -102,6 +102,7 @@ public void fetchCertificate(Collection<String> domains)
while (order.getStatus() != Status.VALID && attempts-- > 0) { while (order.getStatus() != Status.VALID && attempts-- > 0) {
// Did the order fail? // Did the order fail?
if (order.getStatus() == Status.INVALID) { if (order.getStatus() == Status.INVALID) {
LOG.error("Order has failed, reason: {}", order.getError());
throw new AcmeException("Order failed... Giving up."); throw new AcmeException("Order failed... Giving up.");
} }
@ -260,6 +261,7 @@ private void authorize(Authorization auth)
while (challenge.getStatus() != Status.VALID && attempts-- > 0) { while (challenge.getStatus() != Status.VALID && attempts-- > 0) {
// Did the authorization fail? // Did the authorization fail?
if (challenge.getStatus() == Status.INVALID) { if (challenge.getStatus() == Status.INVALID) {
LOG.error("Challenge has failed, reason: {}", challenge.getError());
throw new AcmeException("Challenge failed... Giving up."); throw new AcmeException("Challenge failed... Giving up.");
} }

View File

@ -16,11 +16,11 @@ Order order = account.newOrder()
!!! note !!! note
The number of domains per certificate may be limited. See your CA's documentation for the limits. The number of domains per certificate may be limited. See your CA's documentation for the limits.
The `Order` resource contains a collection of `Authorization`s that can be read from the `getAuthorizations()` method. You must process _all of them_ in order to get the certificate, except those with a `VALID` status. The `Order` resource contains a collection of `Authorization`s that can be read from the `getAuthorizations()` method. In order to get the certificate, you must process _all of them_ that are in a `PENDING` state.
```java ```java
for (Authorization auth : order.getAuthorizations()) { for (Authorization auth : order.getAuthorizations()) {
if (auth.getStatus() != Status.VALID) { if (auth.getStatus() == Status.PENDING) {
processAuth(auth); processAuth(auth);
} }
} }