Skip to content
Snippets Groups Projects
Commit a07932ee authored by Jake Taylor's avatar Jake Taylor
Browse files

port unique constraint error into dm

parent dc56852b
Branches
Tags
1 merge request!67fix for latest client release
......@@ -417,8 +417,7 @@ func (w *wasmModel) receiveHelper(
// Store message to database
result, err := impl.Put(w.db, messageStoreName, messageObj)
if err != nil && !strings.Contains(err.Error(),
"at least one key does not satisfy the uniqueness requirements") {
if err != nil && !strings.Contains(err.Error(), impl.ErrUniqueConstraint) {
// Only return non-unique constraint errors so that the case
// below this one can be hit and handle duplicate entries properly.
return 0, errors.Errorf("Unable to put Message: %+v", err)
......
......@@ -288,7 +288,9 @@ func (w *wasmModel) receiveHelper(
// Store message to database
result, err := impl.Put(w.db, messageStoreName, messageObj)
if err != nil {
if err != nil && !strings.Contains(err.Error(), impl.ErrUniqueConstraint) {
// Only return non-unique constraint errors so that the case
// below this one can be hit and handle duplicate entries properly.
return 0, errors.Errorf("Unable to put Message: %+v", err)
}
......
......@@ -30,6 +30,9 @@ const (
// ErrDoesNotExist is an error string for got undefined on Get operations.
ErrDoesNotExist = "result is undefined"
// ErrUniqueConstraint is an error string for failed uniqueness inserts.
ErrUniqueConstraint = "at least one key does not satisfy the uniqueness requirements"
)
// NewContext builds a context for indexedDb operations.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment