summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/errors.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-05-09 23:00:23 +0200
committerGitHub <noreply@github.com>2022-05-09 23:00:23 +0200
commit1e55dd47f251ae588fb418ac29cbc6a0ae741e69 (patch)
treeb3b930c3f864d82ebeb079fcfbbf570b1620ca3f /vendor/go.mau.fi/whatsmeow/errors.go
parent700b95546b4fbc4bbd094ab1804406c13634d7e2 (diff)
downloadmatterbridge-msglm-1e55dd47f251ae588fb418ac29cbc6a0ae741e69.tar.gz
matterbridge-msglm-1e55dd47f251ae588fb418ac29cbc6a0ae741e69.tar.bz2
matterbridge-msglm-1e55dd47f251ae588fb418ac29cbc6a0ae741e69.zip
Update dependencies (#1831)
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/errors.go')
-rw-r--r--vendor/go.mau.fi/whatsmeow/errors.go34
1 files changed, 28 insertions, 6 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/errors.go b/vendor/go.mau.fi/whatsmeow/errors.go
index 8b68bd0e..d11cbb37 100644
--- a/vendor/go.mau.fi/whatsmeow/errors.go
+++ b/vendor/go.mau.fi/whatsmeow/errors.go
@@ -15,11 +15,10 @@ import (
// Miscellaneous errors
var (
- ErrNoSession = errors.New("can't encrypt message for device: no signal session established")
- ErrIQTimedOut = errors.New("info query timed out")
- ErrIQDisconnected = errors.New("websocket disconnected before info query returned response")
- ErrNotConnected = errors.New("websocket not connected")
- ErrNotLoggedIn = errors.New("the store doesn't contain a device JID")
+ ErrNoSession = errors.New("can't encrypt message for device: no signal session established")
+ ErrIQTimedOut = errors.New("info query timed out")
+ ErrNotConnected = errors.New("websocket not connected")
+ ErrNotLoggedIn = errors.New("the store doesn't contain a device JID")
ErrAlreadyConnected = errors.New("websocket is already connected")
@@ -47,6 +46,10 @@ var (
ErrBusinessMessageLinkNotFound = errors.New("that business message link does not exist or has been revoked")
// ErrInvalidImageFormat is returned by SetGroupPhoto if the given photo is not in the correct format.
ErrInvalidImageFormat = errors.New("the given data is not a valid image")
+ // ErrMediaNotAvailableOnPhone is returned by DecryptMediaRetryNotification if the given event contains error code 2.
+ ErrMediaNotAvailableOnPhone = errors.New("media no longer available on phone")
+ // ErrUnknownMediaRetryError is returned by DecryptMediaRetryNotification if the given event contains an unknown error code.
+ ErrUnknownMediaRetryError = errors.New("unknown media retry error")
)
// Some errors that Client.SendMessage can return
@@ -54,7 +57,6 @@ var (
ErrBroadcastListUnsupported = errors.New("sending to broadcast lists is not yet supported")
ErrUnknownServer = errors.New("can't send message to unknown server")
ErrRecipientADJID = errors.New("message recipient must be normal (non-AD) JID")
- ErrSendDisconnected = errors.New("websocket disconnected before message send returned response")
)
// Some errors that Client.Download can return
@@ -157,3 +159,23 @@ type ElementMissingError struct {
func (eme *ElementMissingError) Error() string {
return fmt.Sprintf("missing <%s> element in %s", eme.Tag, eme.In)
}
+
+var ErrIQDisconnected = &DisconnectedError{Action: "info query"}
+
+// DisconnectedError is returned if the websocket disconnects before an info query or other request gets a response.
+type DisconnectedError struct {
+ Action string
+ Node *waBinary.Node
+}
+
+func (err *DisconnectedError) Error() string {
+ return fmt.Sprintf("websocket disconnected before %s returned response", err.Action)
+}
+
+func (err *DisconnectedError) Is(other error) bool {
+ otherDisc, ok := other.(*DisconnectedError)
+ if !ok {
+ return false
+ }
+ return otherDisc.Action == err.Action
+}