feat: provide better error messages when input param is invalid #1603
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.
Currently when I run a DB procedure that requires a TVP input that has many columns and rows, if at least one value of that is incorrect (e.g. fails with a
The number NaN cannot be converted to a BigInt because it is not an integer
error), I only get that error message - without highlighting which param value is the faulty one. It looks like this:Finding the cause is very difficult then, I basically have to check every value 1-by-1 manually to see which one is wrong... or put a
debugger
into the tedious source code.This PR a bit improves that behaviour. If an error is thrown during the
generateParameterData
call, the error is wrapped, and its' message is kept, but also enhanced with information about which param is the wrong one.P.S. I can add some tests or change the implementation if you want, just let me know if you're okay with the general idea of doing this.