Yield LEVEL_LOCKED error when lock is held#8
Merged
Conversation
This allows `level-party` or `rave-level` (its `abstract-level` replacement) to catch this specific error, instead of using a catch-all that swallows other errors.
vweevers
added a commit
to Level/abstract-level
that referenced
this pull request
Mar 12, 2022
vweevers
added a commit
to Level/abstract-level
that referenced
this pull request
Mar 20, 2022
40 tasks
vweevers
commented
Mar 20, 2022
Comment on lines
+448
to
+451
| if (strlen(errMsg_) > 15 && strncmp("IO error: lock ", errMsg_, 15) == 0) { // env_posix.cc | ||
| argv = CreateCodeError(env, "LEVEL_LOCKED", errMsg_); | ||
| } else if (strlen(errMsg_) > 19 && strncmp("IO error: LockFile ", errMsg_, 19) == 0) { // env_win.cc | ||
| argv = CreateCodeError(env, "LEVEL_LOCKED", errMsg_); |
Member
Author
There was a problem hiding this comment.
This platform difference will be gone once we upgrade LevelDB - but we'll still have to compare the error message. I don't see a cleaner way atm, short of patching upstream to return a more specific leveldb::Status.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows
rave-level(theabstract-levelreplacement oflevel-party) to catch this specific error, instead of using a catch-all that swallows other errors.