This commit is contained in:
Hank Shen 2023-10-09 12:45:11 +08:00
parent a9590b4584
commit 70411ec97c

View file

@ -286,7 +286,7 @@ func (s *SecureCookie) Encode(name string, value interface{}) (string, error) {
b = encode(b)
// 5. Check length.
if s.maxLength != 0 && len(b) > s.maxLength {
return "", fmt.Errorf("%s: %d", errEncodedValueTooLong, len(b))
return "", fmt.Errorf("[%s] %s: %d", name, errEncodedValueTooLong, len(b))
}
// Done.
return string(b), nil
@ -310,7 +310,7 @@ func (s *SecureCookie) Decode(name, value string, dst interface{}, maxAges ...in
}
// 1. Check length.
if s.maxLength != 0 && len(value) > s.maxLength {
return fmt.Errorf("%s: %d", errValueToDecodeTooLong, len(value))
return fmt.Errorf("[%s] %s: %d", name, errValueToDecodeTooLong, len(value))
}
// 2. Decode from base64.
b, err := decode([]byte(value))