diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-05-07 11:36:45 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-05-07 11:36:45 -0400 |
| commit | 09c91d21b083abc976a4cc6439899fb00438a630 (patch) | |
| tree | 63ef50d67b72f847e85877ce9910b32003b63d6c /err.go | |
| parent | 4ee72fe36dd513bcbad227f7bdd6ed0079d2c95a (diff) | |
| download | lulu-09c91d21b083abc976a4cc6439899fb00438a630.zip | |
implement GET /cover-dimensions
Diffstat (limited to 'err.go')
| -rw-r--r-- | err.go | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -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) +} |