File tree Expand file tree Collapse file tree 2 files changed +40
-4
lines changed Expand file tree Collapse file tree 2 files changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,24 @@ buffer_writes(x::IO, bufsize=SZ_UNBUFFERED_IO) = x
33
33
"""
34
34
isopen(object) -> Bool
35
35
36
- Determine whether an object - such as a stream, timer, or mmap -- is not yet closed. Once an
37
- object is closed, it will never produce a new event. However, a closed stream may still have
38
- data to read in its buffer, use [`eof`](@ref) to check for the ability to read data.
36
+ Determine whether an object - such as a stream, timer, or [`mmap`](@ref Mmap.mmap)
37
+ -- is not yet closed. Once an object is closed, it will never produce a new event.
38
+ However, since a closed stream may still have data to read in its buffer,
39
+ use [`eof`](@ref) to check for the ability to read data.
39
40
Use the `FileWatching` package to be notified when a stream might be writable or readable.
41
+
42
+ # Examples
43
+ ```jldoctest
44
+ julia> io = open("my_file.txt", "w+");
45
+
46
+ julia> isopen(io)
47
+ true
48
+
49
+ julia> close(io)
50
+
51
+ julia> isopen(io)
52
+ false
53
+ ```
40
54
"""
41
55
function isopen end
42
56
Original file line number Diff line number Diff line change 172
172
"""
173
173
showerror(io, e)
174
174
175
- Show a descriptive representation of an exception object.
175
+ Show a descriptive representation of an exception object `e`.
176
+ This method is used to display the exception after a call to [`throw`](@ref).
177
+
178
+ # Examples
179
+ ```jldoctest
180
+ julia> struct MyException <: Exception
181
+ msg::AbstractString
182
+ end
183
+
184
+ julia> function Base.showerror(io::IO, err::MyException)
185
+ print(io, "MyException: ")
186
+ print(io, err.msg)
187
+ end
188
+
189
+ julia> err = MyException("test exception")
190
+ MyException("test exception")
191
+
192
+ julia> sprint(showerror, err)
193
+ "MyException: test exception"
194
+
195
+ julia> throw(MyException("test exception"))
196
+ ERROR: MyException: test exception
197
+ ```
176
198
"""
177
199
showerror (io:: IO , ex) = show (io, ex)
178
200
You can’t perform that action at this time.
0 commit comments