Resolve better error message with field/type name todo, update other panics with query name
This commit is contained in:
parent
b1970aecd2
commit
00dd1dc391
1 changed files with 12 additions and 4 deletions
|
@ -736,10 +736,12 @@ impl GraphQLTypeDefiniton {
|
||||||
let code = &field.resolver_code;
|
let code = &field.resolver_code;
|
||||||
|
|
||||||
if field.is_async {
|
if field.is_async {
|
||||||
// TODO: better error message with field/type name.
|
|
||||||
quote!(
|
quote!(
|
||||||
#name => {
|
#name => {
|
||||||
panic!("Tried to resolve async field with a sync resolver");
|
panic!("Tried to resolve async field {} on type {:?} with a sync resolver",
|
||||||
|
#name,
|
||||||
|
Self::name(_info)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -942,7 +944,10 @@ impl GraphQLTypeDefiniton {
|
||||||
match field {
|
match field {
|
||||||
#( #resolve_matches_async )*
|
#( #resolve_matches_async )*
|
||||||
_ => {
|
_ => {
|
||||||
panic!("Field {} not found on type {}", field, "Mutation");
|
panic!("Field {} not found on type {:?}",
|
||||||
|
field,
|
||||||
|
<Self as #juniper_crate_name::GraphQLType<#scalar>>::name(info)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -992,7 +997,10 @@ impl GraphQLTypeDefiniton {
|
||||||
match field {
|
match field {
|
||||||
#( #resolve_matches )*
|
#( #resolve_matches )*
|
||||||
_ => {
|
_ => {
|
||||||
panic!("Field {} not found on type {}", field, "Mutation");
|
panic!("Field {} not found on type {:?}",
|
||||||
|
field,
|
||||||
|
Self::name(_info)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue