From 23282f058e68aac8bf29216faf90d7f27f6ad8c8 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 27 Nov 2015 13:49:30 +0100 Subject: Add errors --- client.go | 5 +++++ cmd/acme/main.go | 2 ++ errors.go | 15 +++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 errors.go diff --git a/client.go b/client.go index 3674db2..8759ad1 100644 --- a/client.go +++ b/client.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "io/ioutil" + "log" "net/http" ) @@ -25,6 +26,10 @@ func Post(uri string, v interface{}) error { if err != nil { return err } + log.Println(string(body)) + return nil + // premature debug abort + _, err = http.Post(uri, "application/jose+json", bytes.NewReader(body)) if err != nil { return err diff --git a/cmd/acme/main.go b/cmd/acme/main.go index 4e57a23..c5ed22b 100644 --- a/cmd/acme/main.go +++ b/cmd/acme/main.go @@ -12,4 +12,6 @@ func main() { log.Fatal(err) } log.Println(dir) + + acme.Post(dir.NewReg, acme.Registration{}) } diff --git a/errors.go b/errors.go new file mode 100644 index 0000000..ce04bf6 --- /dev/null +++ b/errors.go @@ -0,0 +1,15 @@ +package acme + +import "errors" + +var Errors = map[string]error{ + "badCSR": errors.New("The CSR is unacceptable (e.g., due to a short key)"), + "badNonce": errors.New("The client sent an unacceptable anti-replay nonce"), + "connection": errors.New("The server could not connect to the client for DV"), + "dnssec": errors.New("The server could not validate a DNSSEC signed domain"), + "malformed": errors.New("The request message was malformed"), + "serverInternal": errors.New("The server experienced an internal error"), + "tls": errors.New("The server experienced a TLS error during DV"), + "unauthorized": errors.New("The client lacks sufficient authorization"), + "unknownHost": errors.New("The server could not resolve a domain name"), +} -- cgit v1.2.3