summaryrefslogtreecommitdiffstats
path: root/vendor/go.mau.fi/whatsmeow/store/store.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/store/store.go')
-rw-r--r--vendor/go.mau.fi/whatsmeow/store/store.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/store/store.go b/vendor/go.mau.fi/whatsmeow/store/store.go
index 67fe38fa..19feeb7f 100644
--- a/vendor/go.mau.fi/whatsmeow/store/store.go
+++ b/vendor/go.mau.fi/whatsmeow/store/store.go
@@ -8,6 +8,7 @@
package store
import (
+ "fmt"
"time"
waProto "go.mau.fi/whatsmeow/binary/proto"
@@ -123,6 +124,16 @@ type Device struct {
Contacts ContactStore
ChatSettings ChatSettingsStore
Container DeviceContainer
+
+ DatabaseErrorHandler func(device *Device, action string, attemptIndex int, err error) (retry bool)
+}
+
+func (device *Device) handleDatabaseError(attemptIndex int, err error, action string, args ...interface{}) bool {
+ if device.DatabaseErrorHandler != nil {
+ return device.DatabaseErrorHandler(device, fmt.Sprintf(action, args...), attemptIndex, err)
+ }
+ device.Log.Errorf("Failed to %s: %v", fmt.Sprintf(action, args...), err)
+ return false
}
func (device *Device) Save() error {