emit Problem::check error even if no url found

Lets encrypt can return a clear error when creating a new order without returning an `order_url`. 

A missing `order_url` however triggers an early return with error message `no order URL found`. The error from lets encrypt is then never shown to the crate user.

Swapping the `state` and `url` field instantiation in `new_order`  is enough to let `Problem::check` emit the lets encrypt error.

### Example case
Requesting a certificate for *example.org*:
Original output:
```
missing data: no order URL found
```

New:
```
API error: Error creating new order :: Cannot issue for "example.org": The ACME server refuses to issue a certificate for this domain name, because it is forbidden by policy (urn:ietf:params:acme:error:rejectedIdentifier)
```
This commit is contained in:
David Kleingeld 2023-04-23 11:41:47 +02:00 committed by Dirkjan Ochtman
parent 1a9ce194b7
commit 3257747d6b
1 changed files with 1 additions and 1 deletions

View File

@ -246,8 +246,8 @@ impl Account {
Ok(Order { Ok(Order {
account: self.inner.clone(), account: self.inner.clone(),
nonce, nonce,
url: order_url.ok_or("no order URL found")?,
state: Problem::check::<OrderState>(rsp).await?, state: Problem::check::<OrderState>(rsp).await?,
url: order_url.ok_or("no order URL found")?,
}) })
} }