Skip to content

Commit 8284067

Browse files
committed
fix truncated sqlpage function error traces
1 parent 564f661 commit 8284067

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- New `options_source` parameter in the form component. This allows to dynamically load options for dropdowns from a different SQL file.
1717
- This allows easily implementing autocomplete for form fields with a large number of possible options.
1818
- In the map component, add support for map pins with a description but no title.
19+
- Improved error messages when a parameter of a sqlpage function is invalid. Error traces used to be truncated, and made it hard to understand the exact cause of the error in some cases. In particular, calls to `sqlpage.fetch` would display an unhelpful error message when the HTTP request definition was invalid.
1920

2021
## 0.32.1 (2025-01-03)
2122

src/webserver/database/sqlpage_functions/function_definition_macro.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ macro_rules! sqlpage_functions {
6666
let mut iter_params = params.into_iter();
6767
$(
6868
let $param_name = <$param_type as FunctionParamType<'_>>::from_args(&mut iter_params)
69-
.map_err(|e| anyhow!("Parameter {}: {e}", stringify!($param_name)))?;
69+
.with_context(|| format!("Invalid value for parameter {}", stringify!($param_name)))?;
7070
)*
7171
if let Some(extraneous_param) = iter_params.next() {
7272
anyhow::bail!("Too many arguments. Remove extra argument {}", as_sql(extraneous_param));

0 commit comments

Comments
 (0)