Skip to content
This repository was archived by the owner on Apr 25, 2026. It is now read-only.
This repository was archived by the owner on Apr 25, 2026. It is now read-only.

[TASK] Improve type checking error #955

Description

@Serial-ATA

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 = &params[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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions