From d94be4024ab2cb26c4531e96991387021aba04c6 Mon Sep 17 00:00:00 2001 From: bitcodr Date: Fri, 7 Aug 2020 12:29:09 +0430 Subject: [PATCH] improve error handling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6191e7b..9c5ca1b 100644 --- a/README.md +++ b/README.md @@ -698,7 +698,7 @@ By simply representing the error as a variable (`ErrItemNotFound`), we've ensure func GetItemHandler(w http.ReponseWriter, r http.Request) { item, err := clean.GetItem("123") if err != nil { - if err == clean.ErrItemNotFound { + if errors.Is(err, clean.ErrItemNotFound) { http.Error(w, err.Error(), http.StatusNotFound) return }