Skip to content

Conversation

@lovasoa
Copy link
Collaborator

@lovasoa lovasoa commented Nov 16, 2025

Add parse_run_sql_variables to validate sqlpage.run_sql arguments and provide more descriptive error messages.

The previous error message "data did not match any variant of untagged enum SingleOrVec" was unhelpful when sqlpage.run_sql received invalid variable types. This change introduces specific error messages that identify the problematic variable and expected format.


Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Nov 16, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@lovasoa lovasoa marked this pull request as ready for review November 16, 2025 08:38
@lovasoa
Copy link
Collaborator Author

lovasoa commented Nov 16, 2025

@cursoragent don't rewrite a custom parammap deserializer just for run_sql. Just improve the error messages both in the general parammap deserializer and attach precise descriptive human friendly context to the error in the run_sql call

@cursor
Copy link

cursor bot commented Nov 16, 2025

Makes sense—I'll drop the bespoke parse_run_sql_variables and instead improve error reporting where ParamMap already deserializes:

  • teach SingleOrVec’s Deserialize impl (or a helper used by it) to emit a friendlier message when the value isn’t a string/array of strings
  • wrap the existing serde_json::from_str call in serde_path_to_error so we can attach the precise variable name/path when bubbling the error up from sqlpage.run_sql

That way we reuse the shared deserializer, and run_sql still gives clear, human-readable context without duplicating parsing logic.


Open in Cursor Open in Web

Learn more about Cursor Agents

@lovasoa
Copy link
Collaborator Author

lovasoa commented Nov 18, 2025

@cursoragent no new dependency allowed

@cursor
Copy link

cursor bot commented Nov 18, 2025

Got it—I'll drop serde_path_to_error and rework the error reporting so it relies solely on our existing dependencies (e.g., enhance SingleOrVec’s custom Deserialize messages and add path/context manually in run_sql). Will update the PR shortly.


Open in Cursor Open in Web

Learn more about Cursor Agents

@lovasoa lovasoa merged commit 7cbf503 into main Nov 19, 2025
11 checks passed
@lovasoa lovasoa deleted the cursor/fix-sqlpage-run-sql-data-mismatch-error-8dd9 branch November 19, 2025 00:52
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.

3 participants