Skip to content

Commit 337cf38

Browse files
authored
add a showerror implementation for InvalidStateException (#41901)
1 parent c70db59 commit 337cf38

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

base/channels.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ struct InvalidStateException <: Exception
298298
msg::String
299299
state::Symbol
300300
end
301+
showerror(io::IO, ex::InvalidStateException) = print(io, "InvalidStateException: ", ex.msg)
301302

302303
"""
303304
put!(c::Channel, v)

doc/src/manual/asynchronous-programming.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ A channel can be visualized as a pipe, i.e., it has a write end and a read end :
211211
julia> close(c);
212212
213213
julia> put!(c, 2) # `put!` on a closed channel throws an exception.
214-
ERROR: InvalidStateException("Channel is closed.",:closed)
214+
ERROR: InvalidStateException: Channel is closed.
215215
Stacktrace:
216216
[...]
217217
```
@@ -230,7 +230,7 @@ A channel can be visualized as a pipe, i.e., it has a write end and a read end :
230230
1
231231
232232
julia> take!(c) # No more data available on a closed channel.
233-
ERROR: InvalidStateException("Channel is closed.",:closed)
233+
ERROR: InvalidStateException: Channel is closed.
234234
Stacktrace:
235235
[...]
236236
```

0 commit comments

Comments
 (0)