Skip to content

Improve SQLPage function argument warnings#1225

Open
lovasoa wants to merge 5 commits intomainfrom
better-sql-error-messages
Open

Improve SQLPage function argument warnings#1225
lovasoa wants to merge 5 commits intomainfrom
better-sql-error-messages

Conversation

@lovasoa
Copy link
Collaborator

@lovasoa lovasoa commented Feb 28, 2026

Summary

  • Thread source file path and parent function name through SQLPage function argument extraction via a small context struct.
  • Make warnings for disallowed column/table references and unsupported arguments precise, including file:line, exact function name, and where custom expressions are allowed.
  • Keep behavior non-fatal and clarify that execution continues, while keeping the new messages concise.

Test plan

  • cargo test
  • cargo fmt --all
  • cargo clippy --all-targets --all-features -- -D warnings

Made with Cursor

…oundIdentifier special case

- expr_to_stmt_param returns Result<StmtParam, ExprToParamError>; error carries only line + kind (UnsupportedExpr, UnemulatedFunction, NamedArgs)
- function_args_to_stmt_params logs one formatted message (ctx.format_param_error) then returns Err
- Single unsupported-expr arm; expr_summary() used for description
- Rename ParamWarnContext to ParamExtractContext

Made-with: Cursor
…essage tests; remove are_params_extractable

- When func_call_to_param returns StmtParam::Error, store it and have extract_parameters return Err so parse yields ParsedStatement::Error with specialized message
- Add test_parse_sql_unsupported_expr_in_sqlpage_arg and test_parse_sql_unemulated_function_in_sqlpage_arg
- Remove dead are_params_extractable and its unused import

Made-with: Cursor
…tations

- Overhauled ExprToParamError formatting to construct exact user-friendly descriptions.
- Removed superfluous anyhow::Context prefixes in func_call_to_param.
- Passed source_path properly through validate_function_calls to ensure file line numbers populate the new error template accurately.
- Renamed error test file to match its dynamic error output signature.
- Removed redundant mut mutability warnings on parsing logic loops.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant