aboutsummaryrefslogtreecommitdiffstats
path: root/err.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-05-07 11:36:45 -0400
committerSam Anthony <sam@samanthony.xyz>2026-05-07 11:36:45 -0400
commit09c91d21b083abc976a4cc6439899fb00438a630 (patch)
tree63ef50d67b72f847e85877ce9910b32003b63d6c /err.go
parent4ee72fe36dd513bcbad227f7bdd6ed0079d2c95a (diff)
downloadlulu-09c91d21b083abc976a4cc6439899fb00438a630.zip
implement GET /cover-dimensions
Diffstat (limited to 'err.go')
-rw-r--r--err.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/err.go b/err.go
new file mode 100644
index 0000000..e05d1ff
--- /dev/null
+++ b/err.go
@@ -0,0 +1,41 @@
+package lulu
+
+import (
+ "fmt"
+ "io"
+ "net/http"
+)
+
+type errResp struct {
+ *http.Response
+}
+
+func (e errResp) Error() string {
+ resp := e.Response
+ req := resp.Request
+ body, _ := io.ReadAll(resp.Body)
+ return fmt.Sprintf("lulu: %s %s: %s: %s", req.Method, req.URL, resp.Status, body)
+}
+
+type errReadResp struct {
+ *http.Response
+ error
+}
+
+func (e errReadResp) Error() string {
+ req := e.Response.Request
+ return fmt.Sprintf("lulu: %s %s: error reading response body: %v",
+ req.Method, req.URL, e.error)
+}
+
+type errDecResp struct {
+ *http.Response
+ body []byte
+ error
+}
+
+func (e errDecResp) Error() string {
+ req := e.Response.Request
+ return fmt.Sprintf("lulu: %s %s: error decoding response body %q: %v",
+ req.Method, req.URL, string(e.body), e.error)
+}