File tree Expand file tree Collapse file tree 4 files changed +25
-3
lines changed Expand file tree Collapse file tree 4 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 1+ ## 1.12.2-dev
2+
3+ * Relax parsing of V8 traces to allow a missing initial description.
4+
15## 1.12.1
26
37* Move to ` dart-lang/tools ` monorepo.
Original file line number Diff line number Diff line change @@ -19,7 +19,10 @@ final _terseRegExp = RegExp(r'(-patch)?([/\\].*)?$');
1919/// description of the exception that occurred. That description can be multiple
2020/// lines, so we just look for any line other than the first that begins with
2121/// three or four spaces and "at".
22- final _v8Trace = RegExp (r'\n ?at ' );
22+ ///
23+ /// Sometimes the first line is empty, and sometimes the empty line gets
24+ /// trimmed, so also accept a missing description line.
25+ final _v8Trace = RegExp (r'(?:^|\n) ?at ' );
2326
2427/// A RegExp to match indidual lines of V8's stack traces.
2528///
@@ -175,7 +178,6 @@ class Trace implements StackTrace {
175178 : this (
176179 trace
177180 .split ('\n ' )
178- .skip (1 )
179181 // It's possible that an Exception's description contains a line
180182 // that looks like a V8 trace line, which will screw this up.
181183 // Unfortunately, that's impossible to detect.
Original file line number Diff line number Diff line change 11name : stack_trace
2- version : 1.12.1
2+ version : 1.12.2-wip
33description : A package for manipulating stack traces and printing them readably.
44repository : https://github.com/dart-lang/tools/tree/main/pkgs/stack_trace
55issue_tracker : https://github.com/dart-lang/tools/labels/package%3Astack_trace
Original file line number Diff line number Diff line change @@ -90,6 +90,22 @@ void main() {
9090 expect (
9191 trace.frames[2 ].uri, equals (Uri .parse ('https://pub.dev/thing.js' )));
9292 expect (trace.frames[2 ].member, equals ('<fn>.zip.zap' ));
93+
94+ // Missing description line
95+ trace =
96+ Trace .parse (' at Foo._bar (https://example.com/stuff.js:42:21)\n '
97+ ' at https://example.com/stuff.js:0:2\n '
98+ ' at (anonymous function).zip.zap '
99+ '(https://pub.dev/thing.js:1:100)' );
100+
101+ expect (trace.frames[0 ].uri,
102+ equals (Uri .parse ('https://example.com/stuff.js' )));
103+ expect (trace.frames[1 ].uri,
104+ equals (Uri .parse ('https://example.com/stuff.js' )));
105+ expect (trace.frames[1 ].member, equals ('<fn>' ));
106+ expect (
107+ trace.frames[2 ].uri, equals (Uri .parse ('https://pub.dev/thing.js' )));
108+ expect (trace.frames[2 ].member, equals ('<fn>.zip.zap' ));
93109 });
94110
95111 // JavaScriptCore traces are just like V8, except that it doesn't have a
You can’t perform that action at this time.
0 commit comments