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

Side by Side Diff: editor/util/plugins/com.google.dart.java2dart/resources/java_engine.dart

Issue 304293010: Fixes to CaughtException and AnalysisException (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix toString Created 6 years, 6 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 library java.engine; 1 library java.engine;
2 2
3 import 'java_core.dart'; 3 import 'java_core.dart';
4 4
5 /** 5 /**
6 * A predicate is a one-argument function that returns a boolean value. 6 * A predicate is a one-argument function that returns a boolean value.
7 */ 7 */
8 typedef bool Predicate<E>(E argument); 8 typedef bool Predicate<E>(E argument);
9 9
10 class StringUtilities { 10 class StringUtilities {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 * The exception that caused this exception, or `null` if this exception was 248 * The exception that caused this exception, or `null` if this exception was
249 * not caused by another exception. 249 * not caused by another exception.
250 */ 250 */
251 final CaughtException cause; 251 final CaughtException cause;
252 252
253 /** 253 /**
254 * Initialize a newly created exception to have the given [message] and 254 * Initialize a newly created exception to have the given [message] and
255 * [cause]. 255 * [cause].
256 */ 256 */
257 AnalysisException([this.message = 'Exception', this.cause = null]); 257 AnalysisException([this.message = 'Exception', this.cause = null]);
258
259 String toString() {
260 StringBuffer buffer = new StringBuffer();
261 buffer.write("AnalysisException: ");
262 buffer.writeln(message);
263 if (cause != null) {
264 buffer.write('Caused by ');
265 cause._writeOn(buffer);
266 }
267 return buffer.toString();
268 }
258 } 269 }
259 270
260 271
261 /** 272 /**
262 * Instances of the class `CaughtException` represent an exception that was 273 * Instances of the class `CaughtException` represent an exception that was
263 * caught and has an associated stack trace. 274 * caught and has an associated stack trace.
264 */ 275 */
265 class CaughtException implements Exception { 276 class CaughtException implements Exception {
266 /** 277 /**
267 * The exception that was caught. 278 * The exception that was caught.
268 */ 279 */
269 final Exception exception; 280 final Object exception;
270 281
271 /** 282 /**
272 * The stack trace associated with the exception. 283 * The stack trace associated with the exception.
273 */ 284 */
274 StackTrace stackTrace; 285 StackTrace stackTrace;
275 286
276 /** 287 /**
277 * Initialize a newly created caught exception to have the given [exception] 288 * Initialize a newly created caught exception to have the given [exception]
278 * and [stackTrace]. 289 * and [stackTrace].
279 */ 290 */
(...skipping 30 matching lines...) Expand all
310 if (cause != null) { 321 if (cause != null) {
311 buffer.write('Caused by '); 322 buffer.write('Caused by ');
312 cause._writeOn(buffer); 323 cause._writeOn(buffer);
313 } 324 }
314 } else { 325 } else {
315 buffer.writeln(exception.toString()); 326 buffer.writeln(exception.toString());
316 buffer.writeln(stackTrace.toString()); 327 buffer.writeln(stackTrace.toString());
317 } 328 }
318 } 329 }
319 } 330 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/java_engine.dart » ('j') | pkg/analyzer/lib/src/generated/java_engine.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698