Skip to content

Commit bdf8302

Browse files
committed
chore: adjust error message for missing param type in query!()
1 parent a0e90c6 commit bdf8302

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

sqlx-macros-core/src/query/args.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use quote::{format_ident, quote, quote_spanned};
66
use sqlx_core::config::Config;
77
use sqlx_core::describe::Describe;
88
use sqlx_core::type_checking;
9-
use sqlx_core::type_checking::Error;
109
use sqlx_core::type_info::TypeInfo;
1110
use syn::spanned::Spanned;
1211
use syn::{Expr, ExprCast, ExprGroup, Type};
@@ -130,7 +129,10 @@ fn get_param_type<DB: DatabaseExt>(
130129
"optional sqlx feature `{feature_gate}` required for type {param_ty} of param #{param_num}",
131130
)
132131
} else {
133-
format!("unsupported type {param_ty} for param #{param_num}")
132+
format!(
133+
"no built-in mapping for type {param_ty} of param #{param_num}; \
134+
a type override may be required, see documentation for details"
135+
)
134136
}
135137
}
136138
type_checking::Error::DateTimeCrateFeatureNotEnabled => {
@@ -160,11 +162,12 @@ fn get_param_type<DB: DatabaseExt>(
160162
)
161163
}
162164

163-
Error::AmbiguousDateTimeType { fallback } => {
165+
type_checking::Error::AmbiguousDateTimeType { fallback } => {
164166
warnings.ambiguous_datetime = true;
165167
return Ok(fallback.parse()?);
166168
}
167-
Error::AmbiguousNumericType { fallback } => {
169+
170+
type_checking::Error::AmbiguousNumericType { fallback } => {
168171
warnings.ambiguous_numeric = true;
169172
return Ok(fallback.parse()?);
170173
}

0 commit comments

Comments
 (0)