mirror of
https://github.com/PrivateCaptcha/PrivateCaptcha.git
synced 2026-05-09 06:21:02 -05:00
Cosmetic improvement
This commit is contained in:
+5
-5
@@ -190,7 +190,7 @@ func FetchCachedOne[T any](ctx context.Context, cache common.Cache[CacheKey, any
|
||||
|
||||
if t, ok := data.(*T); ok {
|
||||
return t, nil
|
||||
} else {
|
||||
} else if data != nil {
|
||||
var expected *T
|
||||
slog.ErrorContext(ctx, "Cache record type does not match", "cacheKey", key, "expected", fmt.Sprintf("%T", expected), "actual", fmt.Sprintf("%T", data))
|
||||
}
|
||||
@@ -206,7 +206,7 @@ func FetchCachedArray[T any](ctx context.Context, cache common.Cache[CacheKey, a
|
||||
|
||||
if t, ok := data.([]*T); ok {
|
||||
return t, nil
|
||||
} else {
|
||||
} else if data != nil {
|
||||
var expected []*T
|
||||
slog.ErrorContext(ctx, "Cache record type does not match", "cacheKey", key, "expected", fmt.Sprintf("%T", expected), "actual", fmt.Sprintf("%T", data))
|
||||
}
|
||||
@@ -339,7 +339,7 @@ func (sf *StoreOneReader[TKey, T]) Read(ctx context.Context) (*T, error) {
|
||||
}
|
||||
|
||||
return t, nil
|
||||
} else {
|
||||
} else if data != nil {
|
||||
var expected *T
|
||||
slog.ErrorContext(ctx, "Cache record type does not match", "cacheKey", sf.CacheKey, "expected", fmt.Sprintf("%T", expected), "actual", fmt.Sprintf("%T", data))
|
||||
}
|
||||
@@ -408,7 +408,7 @@ func (sf *StoreArrayReader[TKey, T]) Read(ctx context.Context) ([]*T, error) {
|
||||
}
|
||||
|
||||
return t, nil
|
||||
} else {
|
||||
} else if data != nil {
|
||||
var expected []*T
|
||||
slog.ErrorContext(ctx, "Cache record type does not match", "cacheKey", sf.CacheKey, "expected", fmt.Sprintf("%T", expected), "actual", fmt.Sprintf("%T", data))
|
||||
}
|
||||
@@ -434,7 +434,7 @@ func (sf *CachedRefreshReader[TKey, T]) Read(ctx context.Context) (*T, bool, err
|
||||
slog.Log(ctx, common.LevelTrace, "Read object through cache", "cacheKey", cacheKey)
|
||||
|
||||
return t, needsRefresh, nil
|
||||
} else {
|
||||
} else if data != nil {
|
||||
var expected *T
|
||||
slog.ErrorContext(ctx, "Cache record type does not match", "cacheKey", cacheKey, "expected", fmt.Sprintf("%T", expected), "actual", fmt.Sprintf("%T", data))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user