Skip to content

Commit

Permalink
reporters: print all details of exception, not only the stack
Browse files Browse the repository at this point in the history
It's fine if canopy wants to highlight the error by printing
the exception message first, the URL, and then the details.

But the details of it shouldn't be just the stacktrace because:
- It doesn't contain the type of the exception.
- It doesn't contain details about InnerExceptions.

I found this the hard way: receiving a "One or more errors
occurred" error, and not knowing what was going on for a while.
Later I realized that the exception was AggregateException
(which normally wraps exceptions that happen in async/parallel
code), and that it had the best explanation in the InnerException
of it.
  • Loading branch information
knocte committed Dec 27, 2016
1 parent a0f0713 commit e8fea28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/canopy/reporters.fs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ type ConsoleReporter() =
Console.WriteLine(ex.Message);
Console.Write("Url: ");
Console.WriteLine(url);
Console.WriteLine("Stack: ");
ex.StackTrace.Split([| "\r\n"; "\n" |], StringSplitOptions.None)
Console.WriteLine("Exception details: ");
ex.ToString().Split([| "\r\n"; "\n" |], StringSplitOptions.None)
|> Array.iter (fun trace ->
Console.ResetColor()
if trace.Contains(".FSharp.") || trace.Contains("canopy.core") || trace.Contains("OpenQA.Selenium") then
Expand Down

0 comments on commit e8fea28

Please sign in to comment.