Skip to content

Improve WrongDescriptor error message by printing the expected descriptor #71

@flip1995

Description

@flip1995

Currently, when reading (or writing) an NPZ file and the type descriptor is not as expected, the error message only shows the descriptor that's in the NPZ file:

ndarray-npy/src/npy/mod.rs

Lines 488 to 490 in 169c116

ReadNpyError::WrongDescriptor(desc) => {
write!(f, "incorrect descriptor ({}) for this type", desc)
}

This could be extended by , expected ({}) showing what descriptor was expected.

I don't know if every place in the code that produces a WrongDescriptor error also knows what the expected descriptor is though. So not sure how feasible this request is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions