From 15075c841cf906948eea8dfa23e192c3fd86a1fd Mon Sep 17 00:00:00 2001 From: James Houlahan Date: Tue, 21 Feb 2023 14:36:49 +0100 Subject: [PATCH] feat: Expose methods to query ErrNoSuchMessage / ErrNoSuchMailbox --- errors.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 errors.go diff --git a/errors.go b/errors.go new file mode 100644 index 00000000..a332279b --- /dev/null +++ b/errors.go @@ -0,0 +1,18 @@ +// Package gluon implements an IMAP4rev1 (+ extensions) mailserver. +package gluon + +import ( + "errors" + + "github.com/ProtonMail/gluon/internal/state" +) + +// IsNoSuchMessage returns true if the error is ErrNoSuchMessage. +func IsNoSuchMessage(err error) bool { + return errors.Is(err, state.ErrNoSuchMessage) +} + +// IsNoSuchMailbox returns true if the error is ErrNoSuchMailbox. +func IsNoSuchMailbox(err error) bool { + return errors.Is(err, state.ErrNoSuchMailbox) +}