summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--errors.go55
1 files changed, 55 insertions, 0 deletions
diff --git a/errors.go b/errors.go
new file mode 100644
index 0000000..9d9833d
--- /dev/null
+++ b/errors.go
@@ -0,0 +1,55 @@
+package securecookie
+
+import "errors"
+
+func IsValueTooLong(err error) bool {
+ return errors.Is(err, errEncodedValueTooLong) || errors.Is(err, errValueToDecodeTooLong)
+}
+
+func IsEncodedValueTooLong(err error) bool {
+ return errors.Is(err, errEncodedValueTooLong)
+}
+
+func IsDecodeValueTooLong(err error) bool {
+ return errors.Is(err, errValueToDecodeTooLong)
+}
+
+func IsNoCodecs(err error) bool {
+ return errors.Is(err, errNoCodecs)
+}
+
+func IsHashKeyNotSet(err error) bool {
+ return errors.Is(err, errHashKeyNotSet)
+}
+
+func IsBlockKeyNotSet(err error) bool {
+ return errors.Is(err, errBlockKeyNotSet)
+}
+
+func IsTimestampInvalid(err error) bool {
+ return errors.Is(err, errTimestampInvalid)
+}
+
+func IsTimestampTooNew(err error) bool {
+ return errors.Is(err, errTimestampTooNew)
+}
+
+func IsTimestampExpired(err error) bool {
+ return errors.Is(err, errTimestampExpired)
+}
+
+func IsDecryptionFailed(err error) bool {
+ return errors.Is(err, errDecryptionFailed)
+}
+
+func IsValueNotByte(err error) bool {
+ return errors.Is(err, errValueNotByte)
+}
+
+func IsValueNotBytePtr(err error) bool {
+ return errors.Is(err, errValueNotBytePtr)
+}
+
+func IsMacInvalid(err error) bool {
+ return errors.Is(err, ErrMacInvalid)
+}