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

Side by Side Diff: runtime/observatory/lib/src/elements/script_inset.dart

Issue 1120133002: Rework error handling in the service protocol and in Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 script_inset_element; 5 library script_inset_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'service_ref.dart'; 10 import 'service_ref.dart';
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 e.classes.add("emptyBreakpoint"); 452 e.classes.add("emptyBreakpoint");
453 e.classes.add('noCopy'); 453 e.classes.add('noCopy');
454 e.text = nbsp; 454 e.text = nbsp;
455 return e; 455 return e;
456 } 456 }
457 e.text = 'B'; 457 e.text = 'B';
458 update() { 458 update() {
459 e.classes.clear(); 459 e.classes.clear();
460 e.classes.add('noCopy'); 460 e.classes.add('noCopy');
461 461
462 if (busy) { 462 if (!line.possibleBpt) {
463 e.classes.add("emptyBreakpoint");
464 e.text = nbsp;
465 } else if (busy) {
463 e.classes.add("busyBreakpoint"); 466 e.classes.add("busyBreakpoint");
464 } else { 467 } else {
465 if (line.breakpoints != null) { 468 if (line.breakpoints != null) {
466 if (line.breakpointResolved) { 469 if (line.breakpointResolved) {
467 e.classes.add("resolvedBreakpoint"); 470 e.classes.add("resolvedBreakpoint");
468 } else { 471 } else {
469 e.classes.add("unresolvedBreakpoint"); 472 e.classes.add("unresolvedBreakpoint");
470 } 473 }
471 } else { 474 } else {
472 e.classes.add("possibleBreakpoint"); 475 e.classes.add("possibleBreakpoint");
473 } 476 }
474 } 477 }
475 } 478 }
476 line.changes.listen((_) => update()); 479 line.changes.listen((_) => update());
477 e.onClick.listen((event) { 480 e.onClick.listen((event) {
478 if (busy) { 481 if (busy) {
479 return; 482 return;
480 } 483 }
481 busy = true; 484 busy = true;
482 if (line.breakpoints == null) { 485 if (line.breakpoints == null) {
483 // No breakpoint. Add it. 486 // No breakpoint. Add it.
484 line.script.isolate.addBreakpoint(line.script, line.line).then((_) { 487 line.script.isolate.addBreakpoint(line.script, line.line).then((_) {
485 busy = false; 488 busy = false;
486 update(); 489 update();
490 }).catchError((e, st) {
491 bool suppressError = false;
492 if (e is ServerRpcException) {
493 ServerRpcException se = e;
494 suppressError = (se.code == ServerRpcException.kNoBreakAtLine);
495 }
496 if (!suppressError) {
497 return new Future.error(e, st);
Cutch 2015/05/13 17:50:09 Maybe cleaner as: if (e is ServiceRpcException &&
turnidge 2015/05/14 17:53:43 Rewritten.
498 }
487 }); 499 });
488 } else { 500 } else {
489 // Existing breakpoint. Remove it. 501 // Existing breakpoint. Remove it.
490 List pending = []; 502 List pending = [];
491 for (var bpt in line.breakpoints) { 503 for (var bpt in line.breakpoints) {
492 pending.add(line.script.isolate.removeBreakpoint(bpt)); 504 pending.add(line.script.isolate.removeBreakpoint(bpt));
493 } 505 }
494 Future.wait(pending).then((_) { 506 Future.wait(pending).then((_) {
495 busy = false; 507 busy = false;
496 update(); 508 update();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 } 568 }
557 569
558 // So blank lines are included when copying script to the clipboard. 570 // So blank lines are included when copying script to the clipboard.
559 e.append(span('\n')); 571 e.append(span('\n'));
560 572
561 return e; 573 return e;
562 } 574 }
563 575
564 ScriptInsetElement.created() : super.created(); 576 ScriptInsetElement.created() : super.created();
565 } 577 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698