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

Side by Side Diff: pkg/scheduled_test/lib/src/schedule_error.dart

Issue 12473003: Remove deprecated StringBuffer.add, addAll and addCharCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library schedule_error; 5 library schedule_error;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'schedule.dart'; 9 import 'schedule.dart';
10 import 'task.dart'; 10 import 'task.dart';
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 bool operator ==(other) => other is ScheduleError && task == other.task && 57 bool operator ==(other) => other is ScheduleError && task == other.task &&
58 queue == other.queue && _stateWhenDetected == other._stateWhenDetected && 58 queue == other.queue && _stateWhenDetected == other._stateWhenDetected &&
59 error == other.error && stackTrace == other.stackTrace && 59 error == other.error && stackTrace == other.stackTrace &&
60 cause == other.cause; 60 cause == other.cause;
61 61
62 String toString() { 62 String toString() {
63 var result = new StringBuffer(); 63 var result = new StringBuffer();
64 64
65 var errorString = error.toString(); 65 var errorString = error.toString();
66 if (errorString.contains("\n")) { 66 if (errorString.contains("\n")) {
67 result.add('ScheduleError:\n'); 67 result.write('ScheduleError:\n');
68 result.add(prefixLines(errorString.trim())); 68 result.write(prefixLines(errorString.trim()));
69 result.add("\n\n"); 69 result.write("\n\n");
70 } else { 70 } else {
71 result.add('ScheduleError: "$errorString"\n'); 71 result.write('ScheduleError: "$errorString"\n');
72 } 72 }
73 73
74 result.add('Stack trace:\n'); 74 result.write('Stack trace:\n');
75 result.add(prefixLines(stackTrace.toString().trim())); 75 result.write(prefixLines(stackTrace.toString().trim()));
76 result.add("\n\n"); 76 result.write("\n\n");
77 77
78 if (task != null) { 78 if (task != null) {
79 result.add('Error detected during task in queue "$queue":\n'); 79 result.write('Error detected during task in queue "$queue":\n');
80 result.add(task.generateTree()); 80 result.write(task.generateTree());
81 } else if (_stateWhenDetected == ScheduleState.DONE) { 81 } else if (_stateWhenDetected == ScheduleState.DONE) {
82 result.add('Error detected after all tasks in the schedule had ' 82 result.write('Error detected after all tasks in the schedule had '
83 'finished.'); 83 'finished.');
84 } else if (_stateWhenDetected == ScheduleState.RUNNING) { 84 } else if (_stateWhenDetected == ScheduleState.RUNNING) {
85 result.add('Error detected when waiting for out-of-band callbacks in ' 85 result.write('Error detected when waiting for out-of-band callbacks in '
86 'queue "$queue".'); 86 'queue "$queue".');
87 } else { // _stateWhenDetected == ScheduleState.SET_UP 87 } else { // _stateWhenDetected == ScheduleState.SET_UP
88 result.add('Error detected before the schedule started running.'); 88 result.write('Error detected before the schedule started running.');
89 } 89 }
90 90
91 return result.toString(); 91 return result.toString();
92 } 92 }
93 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698