Skip to content

Yield LEVEL_LOCKED error when lock is held#8

Merged
vweevers merged 3 commits into
mainfrom
locked-error-code
Mar 25, 2022
Merged

Yield LEVEL_LOCKED error when lock is held#8
vweevers merged 3 commits into
mainfrom
locked-error-code

Conversation

@vweevers
Copy link
Copy Markdown
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 thread binding.cc
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
Copy Markdown
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 requested a review from ralphtheninja March 20, 2022 23:53
@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

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant