Fix incorrect raising of database_does_not_exist error#4794
Merged
Conversation
When we're raising the error with the args list [1], the format for the args is a list of arguments not a single arg. So the previous invocations of `erlang:error(database_does_not_exist, ?b2l(Id))` would produce a args list of individual database name characters [2]. [1] https://www.erlang.org/doc/man/erlang#error-2 [2] > mem3_shards:opts_for_db(<<"doesnotexit">>). ``` ** exception error: database_does_not_exist in function mem3_shards:opts_for_db/11 called as mem3_shards:opts_for_db(100,111,101,115,110,111,116,101,120,105,116) ```
Contributor
Author
|
With the fix it should look like: |
jaydoane
approved these changes
Oct 4, 2023
Contributor
jaydoane
left a comment
There was a problem hiding this comment.
Of the 4 changes, seems like only the line in fabric_db_create.erl is covered by tests. Still, it's easy to see by inspection that this is the correct fix (as long as DbName is a binary in all cases), so +1 from me.
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.
When we're raising the error with the args list [1], the format for the args is a list of arguments not a single arg. So the previous invocations of
erlang:error(database_does_not_exist, ?b2l(Id))would produce a args list of individual database name characters [2].[1] https://www.erlang.org/doc/man/erlang#error-2
[2] > mem3_shards:opts_for_db(<<"doesnotexit">>).