Skip to content

Commit 6f7416a

Browse files
committed
Provide descriptive panic for Type<Any>::type_info
Replace `unimplemented!()` with a detailed panic message explaining that `Any` driver does not support static type information, guiding users to use `query` instead of `query!` macros.
1 parent 76a804b commit 6f7416a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

sqlx-core/src/any/type.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ macro_rules! impl_any_type {
88
($ty:ty) => {
99
impl crate::types::Type<crate::any::Any> for $ty {
1010
fn type_info() -> crate::any::AnyTypeInfo {
11-
// FIXME: nicer panic explaining why this isn't possible
12-
unimplemented!()
11+
panic!(
12+
"Type::type_info() is not implemented for Any \n\
13+
\n\
14+
This is because `Any` is a dynamic driver and does not support compile-time type verification. \n\
15+
\n\
16+
If you are using `query!` or `query_as!`, use `query` or `query_as` instead."
17+
);
1318
}
1419

1520
fn compatible(ty: &crate::any::AnyTypeInfo) -> bool {

0 commit comments

Comments
 (0)