feat: add error handling in api handler
This commit is contained in:
@@ -16,6 +16,8 @@ func GetItem(cache *cache.Cache) echo.HandlerFunc {
|
|||||||
|
|
||||||
if found {
|
if found {
|
||||||
resp = fmt.Sprintf("%+v", cachedObj)
|
resp = fmt.Sprintf("%+v", cachedObj)
|
||||||
|
} else {
|
||||||
|
return c.String(http.StatusNotFound, "Key not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.String(http.StatusOK, resp)
|
return c.String(http.StatusOK, resp)
|
||||||
|
1
pkg/cache/distribution.go
vendored
Normal file
1
pkg/cache/distribution.go
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
package cache
|
4
pkg/cache/ping.go
vendored
Normal file
4
pkg/cache/ping.go
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package cache
|
||||||
|
|
||||||
|
func Initialize() {
|
||||||
|
}
|
Reference in New Issue
Block a user