From c72036aa3c7b4bf949f51b20557775ce78694a85 Mon Sep 17 00:00:00 2001 From: tbal999 <53711814+tbal999@users.noreply.github.com> Date: Tue, 1 Feb 2022 11:27:17 +0000 Subject: [PATCH 1/3] Update client.go --- client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 6257f0c..98c3311 100644 --- a/client.go +++ b/client.go @@ -135,8 +135,8 @@ func (c *Client) StoreContext(ctx context.Context, req Request, dest string) err } defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - return errors.New("failed to generate the result PDF") + if resp.StatusCode >= http.StatusBadRequest { + return fmt.Errorf("failed to generate the result PDF - http status code: [%d]", resp.StatusCode) // more details here now! } return writeNewFile(dest, resp.Body) } From 7415783aa5b06e1536288c03c07bfa0dda818533 Mon Sep 17 00:00:00 2001 From: tbal999 <53711814+tbal999@users.noreply.github.com> Date: Wed, 2 Feb 2022 13:16:58 +0000 Subject: [PATCH 2/3] Update client.go --- client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client.go b/client.go index 98c3311..2d333f7 100644 --- a/client.go +++ b/client.go @@ -138,6 +138,11 @@ func (c *Client) StoreContext(ctx context.Context, req Request, dest string) err if resp.StatusCode >= http.StatusBadRequest { return fmt.Errorf("failed to generate the result PDF - http status code: [%d]", resp.StatusCode) // more details here now! } + + if resp.StatusCode < http.StatusOK { + return log.Printf("http status code: [%d]") // maybe the gotenburg server is still processing the request etc - this could be passed through as a bool maybe. + } + return writeNewFile(dest, resp.Body) } From d9fec72a197cc764ff57d69bf49a674c7e4056e4 Mon Sep 17 00:00:00 2001 From: tbal999 <53711814+tbal999@users.noreply.github.com> Date: Wed, 2 Feb 2022 13:17:07 +0000 Subject: [PATCH 3/3] Update client.go --- client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/client.go b/client.go index 2d333f7..258150a 100644 --- a/client.go +++ b/client.go @@ -12,6 +12,7 @@ import ( "path/filepath" "runtime" "strconv" + "log" ) const (