[mirror] a bluesky bot to post golang projects
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #32 from till/fix-everything-omg

fix(cache): error handling

authored by

Till! and committed by
GitHub
c49a77bf 73cb0fe1

+6 -4
+6 -4
internal/content/s3_cache.go
··· 60 60 } 61 61 62 62 // Get returns an object, it follows the original pattern in larry to return redis.Nil when an object 63 - // does not exist, in other case we can use minio.ToErrorResponse(err) to extract more details about the 64 - // potential S3 related error 63 + // does not exist. Other S3 errors (network, 5xx, auth) are propagated so callers can distinguish a 64 + // genuine cache miss from a transient failure. 65 65 func (c *CacheClientS3) Get(key string) (string, error) { 66 - // First check if object exists and get its metadata 67 66 objInfo, err := c.mc.StatObject(c.ctx, c.bucket, key, minio.StatObjectOptions{}) 68 67 if err != nil { 69 - return "", redis.Nil 68 + if minio.ToErrorResponse(err).Code == "NoSuchKey" { 69 + return "", redis.Nil 70 + } 71 + return "", err 70 72 } 71 73 72 74 if expiresAt, ok := objInfo.UserMetadata["expires-at"]; ok {