1
0
Fork 0

fix: acme errors management.

This commit is contained in:
Ludovic Fernandez 2018-05-15 17:28:02 +02:00 committed by Traefiker Bot
parent 1e8df9f245
commit 7a1feb3c51
5 changed files with 82 additions and 51 deletions

View file

@ -1,6 +1,7 @@
package acmev2
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
@ -13,6 +14,18 @@ const (
invalidNonceError = "urn:ietf:params:acme:error:badNonce"
)
// ObtainError is returned when there are specific errors available
// per domain. For example in ObtainCertificate
type ObtainError map[string]error
func (e ObtainError) Error() string {
buffer := bytes.NewBufferString("acme: Error -> One or more domains had a problem:\n")
for dom, err := range e {
buffer.WriteString(fmt.Sprintf("[%s] %s\n", dom, err))
}
return buffer.String()
}
// RemoteError is the base type for all errors specific to the ACME protocol.
type RemoteError struct {
StatusCode int `json:"status,omitempty"`