Skip to content

Commit

Permalink
adds little error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinGallauner committed May 22, 2024
1 parent e387a15 commit 00b8d12
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/collection_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ func (cfg *BookclubServer) AddBookToCollection(isbn string, userId uint) (Book,
}

var book Book
book, _ = cfg.BookRepository.GetBook(isbn) //TODO: handle error
book, err = cfg.BookRepository.GetBook(isbn)
if err != nil {
return Book{}, err
}
if book.ISBN == "" {
book, err = cfg.Client.FetchBook(isbn)
if err != nil {
Expand Down

0 comments on commit 00b8d12

Please sign in to comment.