You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/EventStore.js
+7-11Lines changed: 7 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -403,11 +403,7 @@ class EventStore extends events.EventEmitter {
403
403
condition.raw
404
404
);
405
405
406
-
if(stream.next()!==false){
407
-
thrownewOptimisticConcurrencyError(
408
-
`Optimistic Concurrency error. A conflicting event was committed since the condition was obtained.`
409
-
);
410
-
}
406
+
assert(stream.next()===false,`Optimistic Concurrency error. A conflicting event was committed since the condition was obtained.`,OptimisticConcurrencyError);
411
407
}
412
408
413
409
/**
@@ -490,9 +486,10 @@ class EventStore extends events.EventEmitter {
490
486
}
491
487
assert(!this.streams[streamName].closed,`Stream "${streamName}" is closed and cannot be written to.`);
thrownewOptimisticConcurrencyError(`Optimistic Concurrency error. Expected stream "${streamName}" at version ${expectedVersion} but is at version ${streamVersion}.`);
assert(headerMagic===HEADER_MAGIC,`Invalid file version. The index ${this.fileName} was created with a different library version (${headerMagic.substr(6)}).`);
assert(headerMagic===HEADER_MAGIC,`Invalid file version. The index ${this.fileName} was created with a different library version (${headerMagic.substring(6)}).`);
assert(headerMagic.substr(0,6)===HEADER_MAGIC.substr(0,6),`Invalid file header in partition ${this.name}.`);
119
+
assert(headerMagic.substring(0,6)===HEADER_MAGIC.substring(0,6),`Invalid file header in partition ${this.name}.`);
120
120
121
121
this.header=headerMagic;
122
-
assert(headerMagic===HEADER_MAGIC,`Invalid file version. The partition ${this.name} was created with a different library version (${headerMagic.substr(6)}).`);
122
+
assert(headerMagic===HEADER_MAGIC,`Invalid file version. The partition ${this.name} was created with a different library version (${headerMagic.substring(6)}).`);
0 commit comments