diff --git a/acme/types.go b/acme/types.go index 322640c..65d69b2 100644 --- a/acme/types.go +++ b/acme/types.go @@ -167,7 +167,11 @@ type OrderError struct { } func (oe *OrderError) Error() string { - return fmt.Sprintf("acme: order %s status: %s", oe.OrderURL, oe.Status) + str := fmt.Sprintf("acme: order %s status: %s", oe.OrderURL, oe.Status) + if oe.Problem != nil { + str += fmt.Sprintf("; problem: %s", oe.Problem) + } + return str } // RateLimit reports whether err represents a rate limit error and diff --git a/acme/types_test.go b/acme/types_test.go index 59ce7e7..2a59f6f 100644 --- a/acme/types_test.go +++ b/acme/types_test.go @@ -217,3 +217,19 @@ func TestErrorStringerWithSubproblems(t *testing.T) { t.Errorf("Unexpected error string: wanted %q, got %q", expectedStr, err.Error()) } } + +func TestOrderErrorProblem(t *testing.T) { + oe := &OrderError{ + OrderURL: "url", + Status: "invalid", + Problem: &Error{ + StatusCode: 400, + ProblemType: "type", + Detail: "detail", + }, + } + want := "acme: order url status: invalid; problem: 400 type: detail" + if got := oe.Error(); got != want { + t.Errorf("oe.Error() = %q, want %q", got, want) + } +}