Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Unified Diff: lib/src/trace.dart

Issue 1283113002: Don't throw for unparseable frames. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Code review changes Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/frame.dart ('k') | lib/src/unparsed_frame.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/trace.dart
diff --git a/lib/src/trace.dart b/lib/src/trace.dart
index a1691ed1850f9e9adbdd9b944938862bfb0d0bd4..f615cd26abc67852db2cbc323f4007aa916e4318 100644
--- a/lib/src/trace.dart
+++ b/lib/src/trace.dart
@@ -10,6 +10,7 @@ import 'dart:math' as math;
import 'chain.dart';
import 'frame.dart';
import 'lazy_trace.dart';
+import 'unparsed_frame.dart';
import 'utils.dart';
import 'vm_trace.dart';
@@ -115,7 +116,7 @@ class Trace implements StackTrace {
try {
if (trace.isEmpty) return new Trace(<Frame>[]);
if (trace.contains(_v8Trace)) return new Trace.parseV8(trace);
- if (trace.startsWith("\tat ")) return new Trace.parseJSCore(trace);
+ if (trace.contains("\tat ")) return new Trace.parseJSCore(trace);
if (trace.contains(_firefoxSafariTrace)) {
return new Trace.parseFirefox(trace);
}
@@ -262,7 +263,7 @@ class Trace implements StackTrace {
var newFrames = [];
for (var frame in frames.reversed) {
- if (!predicate(frame)) {
+ if (frame is UnparsedFrame || !predicate(frame)) {
newFrames.add(frame);
} else if (newFrames.isEmpty || !predicate(newFrames.last)) {
newFrames.add(new Frame(
@@ -272,7 +273,7 @@ class Trace implements StackTrace {
if (terse) {
newFrames = newFrames.map((frame) {
- if (!predicate(frame)) return frame;
+ if (frame is UnparsedFrame || !predicate(frame)) return frame;
var library = frame.library.replaceAll(_terseRegExp, '');
return new Frame(Uri.parse(library), null, null, frame.member);
}).toList();
@@ -290,6 +291,7 @@ class Trace implements StackTrace {
// Print out the stack trace nicely formatted.
return frames.map((frame) {
+ if (frame is UnparsedFrame) return "$frame\n";
return '${padRight(frame.location, longest)} ${frame.member}\n';
}).join();
}
« no previous file with comments | « lib/src/frame.dart ('k') | lib/src/unparsed_frame.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698