handle openlibrary errors a lil better
Jes Olson j3s@c3f.net
Tue, 15 Oct 2024 11:12:16 -0400
1 files changed,
2 insertions(+),
0 deletions(-)
jump to
M
openlibrary/openlibrary.go
→
openlibrary/openlibrary.go
@@ -30,12 +30,14 @@ cb := CurrentBooks{}
resp, err := http.Get("https://openlibrary.org/people/j3sj3sj3s/books/currently-reading.json") if err != nil { fmt.Println(err) + return &cb } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) err = json.Unmarshal(body, &cb) if err != nil { fmt.Println(err) + return &cb } return &cb }