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

Unified Diff: pkg/scheduled_test/lib/src/schedule_error.dart

Issue 13839023: Add flag to disable capturing stack traces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add command line option to enable traces. Created 7 years, 8 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 | « pkg/scheduled_test/lib/src/schedule.dart ('k') | pkg/scheduled_test/lib/src/task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/scheduled_test/lib/src/schedule_error.dart
diff --git a/pkg/scheduled_test/lib/src/schedule_error.dart b/pkg/scheduled_test/lib/src/schedule_error.dart
index 3df208a01d353dc8821feb4976f70087f6c7bddc..07dc3bfd6f0d9fc6bc2724b9c7caf9a0282c6823 100644
--- a/pkg/scheduled_test/lib/src/schedule_error.dart
+++ b/pkg/scheduled_test/lib/src/schedule_error.dart
@@ -50,12 +50,8 @@ class ScheduleError extends AsyncError {
error = error.error;
}
- if (stackTrace == null) {
- try {
- throw '';
- } catch (_, thrownStackTrace) {
- stackTrace = thrownStackTrace;
- }
+ if (schedule.captureStackTraces && stackTrace == null) {
+ stackTrace = new Trace.current();
}
return new ScheduleError(schedule, error, stackTrace, cause);
@@ -88,9 +84,11 @@ class ScheduleError extends AsyncError {
result.write('ScheduleError: "$errorString"\n');
}
- result.write('Stack trace:\n');
- result.write(prefixLines(terseTraceString(stackTrace)));
- result.write("\n\n");
+ if (stackTrace != null) {
+ result.write('Stack trace:\n');
+ result.write(prefixLines(terseTraceString(stackTrace)));
+ result.write("\n\n");
+ }
if (task != null) {
result.write('Error detected during task in queue "$queue":\n');
« no previous file with comments | « pkg/scheduled_test/lib/src/schedule.dart ('k') | pkg/scheduled_test/lib/src/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698