Some error message cleanup to fix segfault when transposing sparse vector with illegal values.

This should fix #5190.

I have moved `DimensionMismatch` from the linear algebra specific exceptions to the definitions of exceptions in `base.jl`. This was necessary for using the exception in `sparsematrix.jl`. For consistency I also changed the error messages in `array.jl` to use the exception.