Skip to content

fix(macros): slightly improve unsupported type error message #3856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion sqlx-macros-core/src/query/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ pub fn quote_args<DB: DatabaseExt>(
i + 1,
)
} else {
format!("unsupported type {} for param #{}", param_ty, i + 1)
format!(
"no built in mapping found for type {} for param #{}; \
a type override may be required, see documentation for details",
param_ty,
i + 1
)
}
})?
.parse::<TokenStream>()
Expand Down
5 changes: 3 additions & 2 deletions sqlx-macros-core/src/query/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ fn get_column_type<DB: DatabaseExt>(i: usize, column: &DB::Column) -> TokenStrea
let message =
if let Some(feature_gate) = <DB as TypeChecking>::get_feature_gate(type_info) {
format!(
"optional sqlx feature `{feat}` required for type {ty} of {col}",
"SQLx feature `{feat}` required for type {ty} of {col}",
ty = &type_info,
feat = feature_gate,
col = DisplayColumn {
Expand All @@ -246,7 +246,8 @@ fn get_column_type<DB: DatabaseExt>(i: usize, column: &DB::Column) -> TokenStrea
)
} else {
format!(
"unsupported type {ty} of {col}",
"no built in mapping found for type {ty} of {col}; \
a type override may be required, see documentation for details",
ty = type_info,
col = DisplayColumn {
idx: i,
Expand Down
Loading