Skip to content

Commit

Permalink
Add hardrollback fetch error
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawidpol committed Oct 10, 2023
1 parent 057cb26 commit 0546f99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/client/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,11 @@ Doc.prototype._hardRollback = function(err) {
// This is critical error as it means that our doc is not in usable state
// anymore, we should throw doc error.
logger.error('Hard rollback doc fetch failed.', fetchError, inflightOp);
doc.emit('error', fetchError);

doc.emit('error', new ShareDBError(
ERROR_CODE.ERR_HARD_ROLLBACK_FETCH_FAILED,
'Hard rollback fetch failed: ' + fetchError.message
));
}

if (err.code === ERROR_CODE.ERR_OP_SUBMIT_REJECTED) {
Expand Down
1 change: 1 addition & 0 deletions lib/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ShareDBError.CODES = {
ERR_OP_NOT_ALLOWED_IN_PROJECTION: 'ERR_OP_NOT_ALLOWED_IN_PROJECTION',
ERR_OP_SUBMIT_REJECTED: 'ERR_OP_SUBMIT_REJECTED',
ERR_PENDING_OP_REMOVED_BY_OP_SUBMIT_REJECTED: 'ERR_PENDING_OP_REMOVED_BY_OP_SUBMIT_REJECTED',
ERR_HARD_ROLLBACK_FETCH_FAILED: 'ERR_HARD_ROLLBACK_FETCH_FAILED',
ERR_OP_VERSION_MISMATCH_AFTER_TRANSFORM: 'ERR_OP_VERSION_MISMATCH_AFTER_TRANSFORM',
ERR_OP_VERSION_MISMATCH_DURING_TRANSFORM: 'ERR_OP_VERSION_MISMATCH_DURING_TRANSFORM',
ERR_OP_VERSION_NEWER_THAN_CURRENT_SNAPSHOT: 'ERR_OP_VERSION_NEWER_THAN_CURRENT_SNAPSHOT',
Expand Down

0 comments on commit 0546f99

Please sign in to comment.