wasSharpNET – Diff between revs 23 and 24
?pathlinks?
Rev 23 | Rev 24 | |||
---|---|---|---|---|
Line 12... | Line 12... | |||
12 | |
12 | |
|
13 | namespace wasSharpNET.Diagnostics |
13 | namespace wasSharpNET.Diagnostics |
|
14 | { |
14 | { |
|
15 | public static class ExceptionExtensions |
15 | public static class ExceptionExtensions |
|
16 | { |
16 | { |
|
17 | public static string PrettyPrint(this Exception ex) |
17 | public static string PrettyPrint(this Exception ex, int columns = 75) |
|
18 | { |
18 | { |
|
19 | if(ex == null) |
19 | if(ex == null) |
|
Line 20... | Line 20... | |||
20 | return string.Empty; |
20 | return string.Empty; |
|
Line 32... | Line 32... | |||
32 | var fileName = frame?.GetFileName(); |
32 | var fileName = frame?.GetFileName(); |
|
33 | if (string.IsNullOrEmpty(fileName)) |
33 | if (string.IsNullOrEmpty(fileName)) |
|
34 | continue; |
34 | continue; |
|
Line 35... | Line 35... | |||
35 | |
35 | |
|
36 | sb.Append(Enumerable |
36 | sb.Append(Enumerable |
|
37 | .Repeat('-', 75) |
37 | .Repeat('-', columns) |
|
38 | .Concat(Environment.NewLine) |
38 | .Concat(Environment.NewLine) |
|
39 | .ToArray()); |
39 | .ToArray()); |
|
40 | sb.Append("File: "); |
40 | sb.Append("File: "); |
|
41 | sb.Append(fileName); |
41 | sb.Append(fileName); |
|
Line 47... | Line 47... | |||
47 | sb.Append(frame.GetFileColumnNumber()); |
47 | sb.Append(frame.GetFileColumnNumber()); |
|
48 | sb.Append(Environment.NewLine); |
48 | sb.Append(Environment.NewLine); |
|
49 | } |
49 | } |
|
Line 50... | Line 50... | |||
50 | |
50 | |
|
51 | sb.Append(Enumerable |
51 | sb.Append(Enumerable |
|
52 | .Repeat('-', 75) |
52 | .Repeat('-', columns) |
|
53 | .Concat(Environment.NewLine) |
53 | .Concat(Environment.NewLine) |
|
54 | .ToArray()); |
54 | .ToArray()); |
|
55 | sb.Append(ex); |
55 | sb.Append(ex); |
|
56 | sb.Append(Environment.NewLine); |
56 | sb.Append(Environment.NewLine); |
|
57 | sb.Append(Enumerable |
57 | sb.Append(Enumerable |
|
58 | .Repeat('-', 75) |
58 | .Repeat('-', columns) |
|
59 | .Concat(Environment.NewLine) |
59 | .Concat(Environment.NewLine) |
|
Line 60... | Line 60... | |||
60 | .ToArray()); |
60 | .ToArray()); |
|
61 | |
61 | |