fix(context.go): 34 get* functions silently discard type assertion...

Changed getTyped and all 34 Get* functions to return (T, bool) so callers can detect type mismatches.
This commit is contained in:
shanecodezzz 2026-02-14 19:53:19 -08:00
parent f5c267d2f8
commit b91e9e6f3a

View File

@ -302,7 +302,10 @@ func (c *Context) MustGet(key any) any {
func getTyped[T any](c *Context, key any) (res T) {
if val, ok := c.Get(key); ok && val != nil {
res, _ = val.(T)
res, ok = val.(T)
if !ok {
debugPrint("[WARNING] failed to convert key %v with value %v to type %T", key, val, res)
}
}
return
}