Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yield LEVEL_LOCKED error when lock is held #8

Merged
merged 3 commits into from
Mar 25, 2022
Merged

Conversation

vweevers
Copy link
Member

@vweevers vweevers commented Mar 12, 2022

This allows rave-level (the abstract-level replacement of level-party) to catch this specific error, instead of using a catch-all that swallows other errors.

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 vweevers added the semver-minor New features that are backward compatible label Mar 12, 2022
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
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_);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@vweevers vweevers merged commit aa975de into main Mar 25, 2022
@vweevers vweevers deleted the locked-error-code branch March 25, 2022 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor New features that are backward compatible
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant