Repository navigation
Conversation
The readBigInts, returnArrays, allowBareNamedParameters and allowUnknownNamedParameters options were read with `if (Get().ToLocal())`, so a throwing getter left an exception pending while the constructor carried on. Option parsing continued, the database was opened, and the exception was lost, leaving a database file on disk for a constructor call that should have failed. Return as soon as reading any of these options fails, matching how every other option is handled. Signed-off-by: Guilherme Araújo <arauujogui@gmail.com> Assisted-by: Claude
Reading an optional boolean option took about 15 lines of Get/IsUndefined/IsBoolean/throw, repeated for every option across Database's constructor, prepare(), function(), aggregate() and createModule(). That repetition is also what let a missing early return slip into four of the constructor's options. Add ReadOptionalBool(), which reads one property, validates it and reports whether an exception is pending, and use it for every boolean option. Options are still read in the same order, and the error messages are unchanged. Signed-off-by: Guilherme Araújo <arauujogui@gmail.com> Assisted-by: Claude
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66748 +/- ##
==========================================
+ Coverage 90.47% 90.49% +0.02%
==========================================
Files 791 797 +6
Lines 277225 277250 +25
Branches 53313 53273 -40
==========================================
+ Hits 250829 250908 +79
+ Misses 16801 16780 -21
+ Partials 9595 9562 -33
🚀 New features to boost your workflow:
|
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.
new Database(path, options)readreadBigInts,returnArrays,allowBareNamedParametersandallowUnknownNamedParameterswithout returning when the getter threw. The exception was lost, the constructor succeeded, and the database file was created anyway. Those options now propagate the error, and a regression test covers them.Every boolean option in the binding now goes through a single
ReadOptionalBool()helper instead of repeating the read/validate/throw logic for each one. Options are read in the same order and error messages are unchanged.