Improve Relation Definition Error Messages#145
Merged
tamurashingo merged 1 commit intodevelopfrom Feb 4, 2026
Merged
Conversation
- Add query-source-info slot to <query> and <query-placeholder> classes - Save original query definition in query macro - Add format-query-source-info function to format error messages - Update error messages in build-alias-map and generate-join-sql to include query definition - Pass query instance to generate-join-sql for error message context This makes it easier to debug relation errors by showing the original query definition in the error message.
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.
Overview
Improved error messages when there are relation specification errors (such as incorrect relation names) in queries defined with the
querymacro.Background
Currently, when a relation name is incorrect, only a simple error message is displayed:
This message alone does not indicate which query definition caused the error, making debugging difficult.
Changes
1. Add
query-source-infoslot to<query>and<query-placeholder>classesAdded a slot to store the original query definition information.
2. Save query definition in
querymacroSave the original definition information (model, as, columns, joins, where, order-by, limit, offset) only when defined via the
querymacro.3. Add
format-query-source-infofunctionAdded a function to format the query definition in a readable format.
4. Update error messages
Updated error messages in
build-alias-mapandgenerate-join-sqlto include the query definition.Improved Error Messages
When a relation name is incorrect, a detailed error message is now displayed:
This allows developers to immediately identify which query definition caused the error.
Notes
No impact on queries created with
query-builderor directmake-instancequery-source-inforemainsnil, so no additional information is outputFile name output is unnecessary as it's included in the stack trace
Testing