mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 20:22:20 +08:00
refactor(context): improve error message for missing key in context
- Remove unnecessary quotes around the key in the error message - Simplify the error message format for better readability
This commit is contained in:
parent
9c35f7958b
commit
309d0be834
@ -289,7 +289,7 @@ func (c *Context) MustGet(key any) any {
|
|||||||
if value, exists := c.Get(key); exists {
|
if value, exists := c.Get(key); exists {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
panic(fmt.Sprintf("key \"%v\" does not exist", key))
|
panic(fmt.Sprintf("key %v does not exist", key))
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTyped[T any](c *Context, key any) (res T) {
|
func getTyped[T any](c *Context, key any) (res T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user