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
the coercion dunders mentioned in #9 should raise a
ValueErrorwhen they are applied to a non-scalar array. it would be ideal if the error message that is raised is uniform across all frameworkscurrently, this is manually implemented (e.g.
ValueError(f"diagonal requires a 2-D array, got {x.value.ndim}-D")indiagonal)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