File tree 4 files changed +12
-10
lines changed
crates/bevy_reflect/src/func
4 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ impl ArgInfo {
83
83
}
84
84
85
85
/// A representation of an argument.
86
+ ///
87
+ /// This is primarily used for error reporting and debugging.
86
88
#[ derive( Debug , Clone , PartialEq , Eq ) ]
87
89
pub enum ArgId {
88
90
/// The index of the argument within its function.
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ use thiserror::Error;
8
8
pub enum FunctionError {
9
9
/// An error occurred while converting an argument.
10
10
#[ error( transparent) ]
11
- Arg ( #[ from] ArgError ) ,
11
+ ArgError ( #[ from] ArgError ) ,
12
12
/// The number of arguments provided does not match the expected number.
13
13
#[ error( "expected {expected} arguments but received {received}" ) ]
14
- ArgCount { expected : usize , received : usize } ,
14
+ InvalidArgCount { expected : usize , received : usize } ,
15
15
}
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ macro_rules! impl_into_function {
137
137
138
138
$crate:: func:: DynamicFunction :: new( move |args, _info| {
139
139
if args. len( ) != COUNT {
140
- return Err ( $crate:: func:: error:: FunctionError :: ArgCount {
140
+ return Err ( $crate:: func:: error:: FunctionError :: InvalidArgCount {
141
141
expected: COUNT ,
142
142
received: args. len( ) ,
143
143
} ) ;
@@ -186,7 +186,7 @@ macro_rules! impl_into_function {
186
186
187
187
$crate:: func:: DynamicFunction :: new( move |args, _info| {
188
188
if args. len( ) != COUNT {
189
- return Err ( $crate:: func:: error:: FunctionError :: ArgCount {
189
+ return Err ( $crate:: func:: error:: FunctionError :: InvalidArgCount {
190
190
expected: COUNT ,
191
191
received: args. len( ) ,
192
192
} ) ;
@@ -237,7 +237,7 @@ macro_rules! impl_into_function {
237
237
238
238
$crate:: func:: DynamicFunction :: new( move |args, _info| {
239
239
if args. len( ) != COUNT {
240
- return Err ( $crate:: func:: error:: FunctionError :: ArgCount {
240
+ return Err ( $crate:: func:: error:: FunctionError :: InvalidArgCount {
241
241
expected: COUNT ,
242
242
received: args. len( ) ,
243
243
} ) ;
@@ -288,7 +288,7 @@ macro_rules! impl_into_function {
288
288
289
289
$crate:: func:: DynamicFunction :: new( move |args, _info| {
290
290
if args. len( ) != COUNT {
291
- return Err ( $crate:: func:: error:: FunctionError :: ArgCount {
291
+ return Err ( $crate:: func:: error:: FunctionError :: InvalidArgCount {
292
292
expected: COUNT ,
293
293
received: args. len( ) ,
294
294
} ) ;
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ mod tests {
166
166
let result = func. call ( args) ;
167
167
assert_eq ! (
168
168
result. unwrap_err( ) ,
169
- FunctionError :: ArgCount {
169
+ FunctionError :: InvalidArgCount {
170
170
expected: 1 ,
171
171
received: 0
172
172
}
@@ -182,7 +182,7 @@ mod tests {
182
182
let result = func. call ( args) ;
183
183
assert_eq ! (
184
184
result. unwrap_err( ) ,
185
- FunctionError :: ArgCount {
185
+ FunctionError :: InvalidArgCount {
186
186
expected: 0 ,
187
187
received: 1
188
188
}
@@ -198,7 +198,7 @@ mod tests {
198
198
let result = func. call ( args) ;
199
199
assert_eq ! (
200
200
result. unwrap_err( ) ,
201
- FunctionError :: Arg ( ArgError :: UnexpectedType {
201
+ FunctionError :: ArgError ( ArgError :: UnexpectedType {
202
202
id: ArgId :: Index ( 0 ) ,
203
203
expected: Cow :: Borrowed ( i32 :: type_path( ) ) ,
204
204
received: Cow :: Borrowed ( u32 :: type_path( ) )
@@ -215,7 +215,7 @@ mod tests {
215
215
let result = func. call ( args) ;
216
216
assert_eq ! (
217
217
result. unwrap_err( ) ,
218
- FunctionError :: Arg ( ArgError :: InvalidOwnership {
218
+ FunctionError :: ArgError ( ArgError :: InvalidOwnership {
219
219
id: ArgId :: Index ( 0 ) ,
220
220
expected: Ownership :: Ref ,
221
221
received: Ownership :: Owned
You can’t perform that action at this time.
0 commit comments