Overview
When doing a job call, type checking is performed, and the cause of errors is known:
|
pub fn type_checker<C: Constraints, AccountId: Encode + Clone>( |
|
params: &[FieldType], |
|
args: &[Field<C, AccountId>], |
|
) -> Result<(), TypeCheckError> { |
|
if params.len() != args.len() { |
|
return Err(TypeCheckError::NotEnoughArguments { |
|
expected: params.len() as u8, |
|
actual: args.len() as u8, |
|
}); |
|
} |
|
for i in 0..args.len() { |
|
let arg = &args[i]; |
|
let expected = ¶ms[i]; |
|
if arg != expected { |
|
return Err(TypeCheckError::ArgumentTypeMismatch { |
|
index: i as u8, |
|
expected: expected.clone(), |
|
actual: arg.clone().into(), |
|
}); |
|
} |
|
} |
|
Ok(()) |
|
} |
However, the error is then immediately converted to one with no information:
|
job_call.type_check(job_def).map_err(Error::<T>::TypeCheck)?; |
We should retain the information from the original error, otherwise it isn't clear what's gone wrong.
Overview
When doing a job call, type checking is performed, and the cause of errors is known:
tangle/primitives/src/services/jobs.rs
Lines 135 to 157 in 7ee0572
However, the error is then immediately converted to one with no information:
tangle/pallets/services/src/lib.rs
Line 1360 in 7ee0572
We should retain the information from the original error, otherwise it isn't clear what's gone wrong.