feat: add error handling in api handler

This commit is contained in:
Alex Wellnitz
2025-09-12 16:32:00 +02:00
parent 71db22ef46
commit bdc4b51c0e
3 changed files with 7 additions and 0 deletions

View File

@@ -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
View File

@@ -0,0 +1 @@
package cache

4
pkg/cache/ping.go vendored Normal file
View File

@@ -0,0 +1,4 @@
package cache
func Initialize() {
}