From 1e55dd47f251ae588fb418ac29cbc6a0ae741e69 Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 9 May 2022 23:00:23 +0200 Subject: Update dependencies (#1831) --- vendor/go.mau.fi/whatsmeow/errors.go | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'vendor/go.mau.fi/whatsmeow/errors.go') 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 +} -- cgit v1.2.3