Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve CompilationException messaging for generic test Jinja renderi…
…ng (dbt-labs#5393) * feat: Improve generic test UndefinedMacroException message The error message rendered from the `UndefinedMacroException` when raised by a TestBuilder is very vague as to where the problem is and how to resolve it. This commit adds a basic amount of information about the specific model and column that is referencing an undefined macro. Note: All custom macros referenced in a generic test config will raise an UndefinedMacroException as of v0.20.0. * feat: Bubble CompilationException into schemas.py I realized that this exception information would be better if CompilationExceptions inclulded the file that raised the exception. To that end, I created a new exception handler in `_parse_generic_test` to report on CompilationExceptions raised during the parsing of generic tests. Along the way I reformatted the message returned from TestBuilder to play nicely with the the existing formatting of `_parse_generic_test`'s exception handling code. * feat: Add tests to confirm CompileException I've added a basic test to confirm that the approriate CompilationException when a custom macro is referenced in a generic test config. * feat: Add changie entry and tweak error msg * Update .changes/unreleased/Under the Hood-20220617-150744.yaml Thanks to @emmyoop for the recommendation that this be listed as a Fix change instead of an "Under the Hood" change! Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com> * fix: Simplified Compliation Error message I've simplified the error message raised during a Compilation Error sourced from a test config. Mainly by way of removing tabs and newlines where not required. * fix: Convert format to fstring in schemas This commit moves a format call to a multiline fstring in the schemas.py file for CompilationExceptions. Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
- Loading branch information