From fe98ed2992df426521768d69e191b1053f23f388 Mon Sep 17 00:00:00 2001 From: Simon Lightfoot Date: Thu, 15 Feb 2018 19:24:30 +0000 Subject: [PATCH 1/4] Fix stack-trace frame ordering. In order for `Culprit` to be logged correctly it should have the latest frame at th top. --- lib/src/stack_trace.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/stack_trace.dart b/lib/src/stack_trace.dart index ef8ce6218b..d1175d6921 100644 --- a/lib/src/stack_trace.dart +++ b/lib/src/stack_trace.dart @@ -24,7 +24,7 @@ List> encodeStackTrace(dynamic stackTrace) { frames.addAll(chain.traces[t].frames.map(encodeStackTraceFrame)); if (t < chain.traces.length - 1) frames.add(asynchronousGapFrameJson); } - return frames; + return frames.reversed.toList(); } Map encodeStackTraceFrame(Frame frame) { From 87d5803f732e705c1a53b5769d7c4dbb7b89fd75 Mon Sep 17 00:00:00 2001 From: Simon Lightfoot Date: Fri, 13 Apr 2018 20:40:52 +0100 Subject: [PATCH 2/4] Updated tests. --- test/stack_trace_test.dart | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/stack_trace_test.dart b/test/stack_trace_test.dart index eb5ab06f85..3523f5c91c 100644 --- a/test/stack_trace_test.dart +++ b/test/stack_trace_test.dart @@ -34,18 +34,18 @@ void main() { '''), [ { 'abs_path': 'test.dart', - 'function': 'baz', - 'lineno': 50, + 'function': 'bar', + 'lineno': 46, 'in_app': true, 'filename': 'test.dart' }, { 'abs_path': 'test.dart', - 'function': 'bar', - 'lineno': 46, + 'function': 'baz', + 'lineno': 50, 'in_app': true, 'filename': 'test.dart' - } + }, ]); }); @@ -57,8 +57,8 @@ void main() { '''), [ { 'abs_path': 'test.dart', - 'function': 'baz', - 'lineno': 50, + 'function': 'bar', + 'lineno': 46, 'in_app': true, 'filename': 'test.dart' }, @@ -67,11 +67,11 @@ void main() { }, { 'abs_path': 'test.dart', - 'function': 'bar', - 'lineno': 46, + 'function': 'baz', + 'lineno': 50, 'in_app': true, 'filename': 'test.dart' - } + }, ]); }); }); From e92a0c69ea4ff1e2ca3cf81d37ef769fa44170f4 Mon Sep 17 00:00:00 2001 From: Simon Lightfoot Date: Fri, 13 Apr 2018 20:46:58 +0100 Subject: [PATCH 3/4] Fix stack-frame tests. --- test/sentry_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sentry_test.dart b/test/sentry_test.dart index 2e1529c462..d1fba00883 100644 --- a/test/sentry_test.dart +++ b/test/sentry_test.dart @@ -93,7 +93,7 @@ void main() { expect(stacktrace['frames'], const isInstanceOf()); expect(stacktrace['frames'], isNotEmpty); - final Map topFrame = stacktrace['frames'].first; + final Map topFrame = (stacktrace['frames'] as Iterable).last; expect(topFrame.keys, ['abs_path', 'function', 'lineno', 'in_app', 'filename']); expect(topFrame['abs_path'], 'sentry_test.dart'); From 220f6b34b701994de1e059fdba086599505755e8 Mon Sep 17 00:00:00 2001 From: Simon Lightfoot Date: Thu, 26 Apr 2018 18:14:13 +0100 Subject: [PATCH 4/4] dartfmt over test/sentry_test.dart --- test/sentry_test.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/sentry_test.dart b/test/sentry_test.dart index d1fba00883..afc4426a71 100644 --- a/test/sentry_test.dart +++ b/test/sentry_test.dart @@ -93,7 +93,8 @@ void main() { expect(stacktrace['frames'], const isInstanceOf()); expect(stacktrace['frames'], isNotEmpty); - final Map topFrame = (stacktrace['frames'] as Iterable).last; + final Map topFrame = + (stacktrace['frames'] as Iterable).last; expect(topFrame.keys, ['abs_path', 'function', 'lineno', 'in_app', 'filename']); expect(topFrame['abs_path'], 'sentry_test.dart');