SparseArrays.jl
SparseArrays.jl copied to clipboard
Exception prints entire matrix -> crash
I am not exactly sure how to formulate this. I'm not exactly experiencing a bug, but behaviour that reduces the user experience.
An exception is thrown When I try to construct a matrix with malformatted arguments. So far, so good. Unfortunately, the exception contains all data passed to the constructor, which is several millions of entries in my case. I've spent two hours debugging this because neither Jupyter nor Julia show an error because generating the printout takes too long, so instead they just crash.
The problem lies in this line: https://github.com/JuliaSparse/SparseArrays.jl/blob/8f442b8451a37da05da05fa8db32593f9b0ba7de/src/sparsematrix.jl#L30
I don't think printing the entire data has any benefit; the users know the values they feed into the constructor. I suggest to remove the arguments from the exception message.
I think this is a duplicated of https://github.com/JuliaSparse/SparseArrays.jl/issues/99 which have been fixed by https://github.com/JuliaSparse/SparseArrays.jl/pull/100. I don't know what Julia versions that fix is in though.