Skip to content

Commit

Permalink
print Task backtrace in writemime, not show. also use showerror.
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Sep 15, 2015
1 parent 6601d77 commit b8d71b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 8 additions & 0 deletions base/replutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ writemime(io::IO, ::MIME"text/plain", t::Associative) =
writemime(io::IO, ::MIME"text/plain", t::Union{KeyIterator, ValueIterator}) =
showkv(io, t, limit=true)

function writemime(io::IO, ::MIME"text/plain", t::Task)
show(io, t)
if t.state == :failed
println(io)
showerror(io, CapturedException(t.result, t.backtrace))
end
end


# showing exception objects as descriptive error messages

Expand Down
4 changes: 0 additions & 4 deletions base/task.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ Task(f) = Task(()->f())

function show(io::IO, t::Task)
print(io, "Task ($(t.state)) @0x$(hex(convert(UInt, pointer_from_objref(t)), WORD_SIZE>>2))")
if t.state == :failed
println(io)
show(io, CapturedException(t.result, t.backtrace))
end
end

# Container for a captured exception and its backtrace. Can be serialized.
Expand Down

0 comments on commit b8d71b7

Please sign in to comment.