| author | |
| committer | |
| log | 87fb7df25794d12b2316dd41a9111e2206c00152 |
| tree | 47a897f98b92f7e07a0af13b4dc8e90b1ab53a2f |
| parent | ac207073f3426e615e7d4735994f73f67af7ee8e |
4 files changed, 8 insertions(+), 6 deletions(-)
doc/langref.html.in+1-1| ... | ... | @@ -3263,7 +3263,7 @@ fn createFoo(param: i32) !Foo { |
| 3263 | 3263 | <ul> |
| 3264 | 3264 | <li>Return an error from main</li> |
| 3265 | 3265 | <li>An error makes its way to {#syntax#}catch unreachable{#endsyntax#} and you have not overridden the default panic handler</li> |
| 3266 | <li>Use {#link|errorReturnTrace#} to access the current return trace. You can use {#syntax#}std.debug.dumpStackTrace{#endsyntax#} to print it. This function returns comptime-known {#link|null#} when building without error return tracing support.</li> | |
| 3266 | <li>Use {#link|errorReturnTrace#} to access the current return trace. You can use {#syntax#}std.debug.dumpErrorReturnTrace{#endsyntax#} to print it. This function returns comptime-known {#link|null#} when building without error return tracing support.</li> | |
| 3267 | 3267 | </ul> |
| 3268 | 3268 | {#header_open|Implementation Details#} |
| 3269 | 3269 | <p> |
lib/compiler/test_runner.zig+3-3| ... | ... | @@ -144,7 +144,7 @@ fn mainServer(init: std.process.Init.Minimal) !void { |
| 144 | 144 | error.SkipZigTest => .skip, |
| 145 | 145 | else => s: { |
| 146 | 146 | if (@errorReturnTrace()) |trace| { |
| 147 | std.debug.dumpStackTrace(trace); | |
| 147 | std.debug.dumpErrorReturnTrace(trace); | |
| 148 | 148 | } |
| 149 | 149 | break :s .fail; |
| 150 | 150 | }, |
| ... | ... | @@ -312,7 +312,7 @@ fn mainTerminal(init: std.process.Init.Minimal) void { |
| 312 | 312 | std.debug.print("FAIL ({t})\n", .{err}); |
| 313 | 313 | } |
| 314 | 314 | if (@errorReturnTrace()) |trace| { |
| 315 | std.debug.dumpStackTrace(trace); | |
| 315 | std.debug.dumpErrorReturnTrace(trace); | |
| 316 | 316 | } |
| 317 | 317 | test_node.end(); |
| 318 | 318 | }, |
| ... | ... | @@ -438,7 +438,7 @@ var fuzz_runner: if (builtin.fuzz) struct { |
| 438 | 438 | error.SkipZigTest => return, |
| 439 | 439 | else => { |
| 440 | 440 | if (@errorReturnTrace()) |trace| { |
| 441 | std.debug.dumpStackTrace(trace); | |
| 441 | std.debug.dumpErrorReturnTrace(trace); | |
| 442 | 442 | } |
| 443 | 443 | std.debug.print("failed with error.{t}\n", .{err}); |
| 444 | 444 | std.process.exit(1); |
lib/std/Thread.zig+2-2| ... | ... | @@ -442,7 +442,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { |
| 442 | 442 | @call(.auto, f, args) catch |err| { |
| 443 | 443 | std.debug.print("error: {s}\n", .{@errorName(err)}); |
| 444 | 444 | if (@errorReturnTrace()) |trace| { |
| 445 | std.debug.dumpStackTrace(trace); | |
| 445 | std.debug.dumpErrorReturnTrace(trace); | |
| 446 | 446 | } |
| 447 | 447 | }; |
| 448 | 448 | |
| ... | ... | @@ -932,7 +932,7 @@ const WasiThreadImpl = struct { |
| 932 | 932 | @call(.auto, f, w.args) catch |err| { |
| 933 | 933 | std.debug.print("error: {s}\n", .{@errorName(err)}); |
| 934 | 934 | if (@errorReturnTrace()) |trace| { |
| 935 | std.debug.dumpStackTrace(trace); | |
| 935 | std.debug.dumpErrorReturnTrace(trace); | |
| 936 | 936 | } |
| 937 | 937 | }; |
| 938 | 938 | }, |
lib/std/std.zig+2| ... | ... | @@ -165,6 +165,8 @@ pub const Options = struct { |
| 165 | 165 | /// * `debug.dumpCurrentStackTrace` |
| 166 | 166 | /// * `debug.writeStackTrace` |
| 167 | 167 | /// * `debug.dumpStackTrace` |
| 168 | /// * `debug.writeErrorReturnTrace` | |
| 169 | /// * `debug.dumpErrorReturnTrace` | |
| 168 | 170 | /// |
| 169 | 171 | /// Stack traces can generally be collected and printed when debug info is stripped, but are |
| 170 | 172 | /// often less useful since they usually cannot be mapped to source locations and/or have bad |