Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgs/stack_trace/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.12.2-dev

* Relax parsing of V8 traces to allow a missing initial description.

## 1.12.1

* Move to `dart-lang/tools` monorepo.
Expand Down
6 changes: 4 additions & 2 deletions pkgs/stack_trace/lib/src/trace.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ final _terseRegExp = RegExp(r'(-patch)?([/\\].*)?$');
/// description of the exception that occurred. That description can be multiple
/// lines, so we just look for any line other than the first that begins with
/// three or four spaces and "at".
final _v8Trace = RegExp(r'\n ?at ');
///
/// Sometimes the first line is empty, and sometimes the empty line gets
/// trimmed, so also accept a missing description line.
final _v8Trace = RegExp(r'(?:^|\n) ?at ');

/// A RegExp to match indidual lines of V8's stack traces.
///
Expand Down Expand Up @@ -175,7 +178,6 @@ class Trace implements StackTrace {
: this(
trace
.split('\n')
.skip(1)
// It's possible that an Exception's description contains a line
// that looks like a V8 trace line, which will screw this up.
// Unfortunately, that's impossible to detect.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/stack_trace/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: stack_trace
version: 1.12.1
version: 1.12.2-wip
description: A package for manipulating stack traces and printing them readably.
repository: https://github.com/dart-lang/tools/tree/main/pkgs/stack_trace
issue_tracker: https://github.com/dart-lang/tools/labels/package%3Astack_trace
Expand Down
16 changes: 16 additions & 0 deletions pkgs/stack_trace/test/trace_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ void main() {
expect(
trace.frames[2].uri, equals(Uri.parse('https://pub.dev/thing.js')));
expect(trace.frames[2].member, equals('<fn>.zip.zap'));

// Missing description line
trace =
Trace.parse(' at Foo._bar (https://example.com/stuff.js:42:21)\n'
' at https://example.com/stuff.js:0:2\n'
' at (anonymous function).zip.zap '
'(https://pub.dev/thing.js:1:100)');

expect(trace.frames[0].uri,
equals(Uri.parse('https://example.com/stuff.js')));
expect(trace.frames[1].uri,
equals(Uri.parse('https://example.com/stuff.js')));
expect(trace.frames[1].member, equals('<fn>'));
expect(
trace.frames[2].uri, equals(Uri.parse('https://pub.dev/thing.js')));
expect(trace.frames[2].member, equals('<fn>.zip.zap'));
});

// JavaScriptCore traces are just like V8, except that it doesn't have a
Expand Down