Skip to content

Commit befe38f

Browse files
authored
add errorshow for DimensionMismatch (#44121)
Close #44117
1 parent 1813978 commit befe38f

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

base/docs/basedocs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ julia> push!(a, 2, 3)
365365
Assigning `[]` does not eliminate elements from a collection; instead use [`filter!`](@ref).
366366
```jldoctest
367367
julia> a = collect(1:3); a[a .<= 1] = []
368-
ERROR: DimensionMismatch("tried to assign 0 elements to 1 destinations")
368+
ERROR: DimensionMismatch: tried to assign 0 elements to 1 destinations
369369
[...]
370370
371371
julia> filter!(x -> x > 1, a) # in-place & thus more efficient than a = a[a .> 1]

base/errorshow.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ showerror(io::IO, ex::KeyError) = (print(io, "KeyError: key ");
152152
print(io, " not found"))
153153
showerror(io::IO, ex::InterruptException) = print(io, "InterruptException:")
154154
showerror(io::IO, ex::ArgumentError) = print(io, "ArgumentError: ", ex.msg)
155+
showerror(io::IO, ex::DimensionMismatch) = print(io, "DimensionMismatch: ", ex.msg)
155156
showerror(io::IO, ex::AssertionError) = print(io, "AssertionError: ", ex.msg)
156157
showerror(io::IO, ex::OverflowError) = print(io, "OverflowError: ", ex.msg)
157158

stdlib/LinearAlgebra/docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ julia> b = [1 2 3; 4 5 6]
266266
4 5 6
267267
268268
julia> b - U
269-
ERROR: DimensionMismatch("matrix is not square: dimensions are (2, 3)")
269+
ERROR: DimensionMismatch: matrix is not square: dimensions are (2, 3)
270270
Stacktrace:
271271
[...]
272272
```

0 commit comments

Comments
 (0)