Skip to content

Commit

Permalink
add errorshow for DimensionMismatch (#44121)
Browse files Browse the repository at this point in the history
Close #44117
  • Loading branch information
Moelf committed Feb 13, 2022
1 parent 1813978 commit befe38f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ julia> push!(a, 2, 3)
Assigning `[]` does not eliminate elements from a collection; instead use [`filter!`](@ref).
```jldoctest
julia> a = collect(1:3); a[a .<= 1] = []
ERROR: DimensionMismatch("tried to assign 0 elements to 1 destinations")
ERROR: DimensionMismatch: tried to assign 0 elements to 1 destinations
[...]
julia> filter!(x -> x > 1, a) # in-place & thus more efficient than a = a[a .> 1]
Expand Down
1 change: 1 addition & 0 deletions base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ showerror(io::IO, ex::KeyError) = (print(io, "KeyError: key ");
print(io, " not found"))
showerror(io::IO, ex::InterruptException) = print(io, "InterruptException:")
showerror(io::IO, ex::ArgumentError) = print(io, "ArgumentError: ", ex.msg)
showerror(io::IO, ex::DimensionMismatch) = print(io, "DimensionMismatch: ", ex.msg)
showerror(io::IO, ex::AssertionError) = print(io, "AssertionError: ", ex.msg)
showerror(io::IO, ex::OverflowError) = print(io, "OverflowError: ", ex.msg)

Expand Down
2 changes: 1 addition & 1 deletion stdlib/LinearAlgebra/docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ julia> b = [1 2 3; 4 5 6]
4 5 6
julia> b - U
ERROR: DimensionMismatch("matrix is not square: dimensions are (2, 3)")
ERROR: DimensionMismatch: matrix is not square: dimensions are (2, 3)
Stacktrace:
[...]
```
Expand Down

0 comments on commit befe38f

Please sign in to comment.