Skip to content

Unify error messaging #10

Description

@nicola-bastianello

the coercion dunders mentioned in #9 should raise a ValueError when they are applied to a non-scalar array. it would be ideal if the error message that is raised is uniform across all frameworks

currently, this is manually implemented (e.g. ValueError(f"diagonal requires a 2-D array, got {x.value.ndim}-D") in diagonal)

I suggest looking for a way that we can define the error messages only once, e.g. in an Enum, and then call them from the methods as needed. this also means swallowing framework-native errors and "replacing" them with our custom messages

if these error messages are f-strings, we could define them as lambda functions returning f-strings msg = lambda x: f"diagonal requires a 2-D array, got {x}-D" or something similar

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions