aboutsummaryrefslogtreecommitdiff
path: root/errors.go
diff options
context:
space:
mode:
authorHank Shen <swh@admpub.com>2023-12-06 06:51:36 +0300
committerHank Shen <swh@admpub.com>2023-12-06 06:51:36 +0300
commit75a1bf157648c5b5c155ac81e4950bff5315c0ae (patch)
tree0002e25150c8949a660884f9aa753f5adac16f13 /errors.go
parent3faf6fc167dd8a00d6516ad3ad70012869348603 (diff)
update
Diffstat (limited to 'errors.go')
-rw-r--r--errors.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/errors.go b/errors.go
index 9d9833d..8760316 100644
--- a/errors.go
+++ b/errors.go
@@ -2,6 +2,18 @@ package securecookie
import "errors"
+func NewUsageError(err error) *cookieError {
+ return &cookieError{cause: err, typ: usageError}
+}
+
+func NewInternalError(err error) *cookieError {
+ return &cookieError{cause: err, typ: internalError}
+}
+
+func NewDecodeError(err error) *cookieError {
+ return &cookieError{cause: err, typ: decodeError}
+}
+
func IsValueTooLong(err error) bool {
return errors.Is(err, errEncodedValueTooLong) || errors.Is(err, errValueToDecodeTooLong)
}