diff options
author | Hank Shen <swh@admpub.com> | 2023-10-09 08:20:51 +0300 |
---|---|---|
committer | Hank Shen <swh@admpub.com> | 2023-10-09 08:20:51 +0300 |
commit | 1cb0c5289093305a0f28b3371fd38e792d9617e1 (patch) | |
tree | 6d73f4e7b3ba7a744d29d414e473e9668203f7f2 | |
parent | c3c993005c433abc81217fec90a0bca8a9e60b2b (diff) |
updatev1.1.5
-rw-r--r-- | errors.go | 55 |
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) +} |