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

Side by Side Diff: runtime/observatory/lib/src/elements/eval_link.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: fix tests 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 eval_link_element; 5 library eval_link_element;
6 6
7 import 'package:observatory/service.dart'; 7 import 'package:observatory/service.dart';
8 import 'observatory_element.dart';
8 import 'package:polymer/polymer.dart'; 9 import 'package:polymer/polymer.dart';
9 10
10 @CustomTag('eval-link') 11 @CustomTag('eval-link')
11 class EvalLinkElement extends PolymerElement { 12 class EvalLinkElement extends ObservatoryElement {
12 EvalLinkElement.created() : super.created(); 13 EvalLinkElement.created() : super.created();
13 14
14 @observable bool busy = false; 15 @observable bool busy = false;
15 @published String label = "[evaluate]"; 16 @published String label = "[evaluate]";
16 @published var callback = null; 17 @published var callback = null;
17 @published var expr = ''; 18 @published var expr = '';
18 @published ServiceObject result = null; 19 @published var result = null;
20 @published var error = null;
19 21
20 void evalNow(var a, var b, var c) { 22 void evalNow(var a, var b, var c) {
21 if (busy) { 23 if (busy) {
22 return; 24 return;
23 } 25 }
24 if (callback != null) { 26 if (callback != null) {
25 busy = true; 27 busy = true;
26 result = null; 28 result = null;
27 callback(expr).then((ServiceObject obj) { 29 callback(expr).then((ServiceObject obj) {
28 result = obj; 30 result = obj;
29 }).whenComplete(() { 31 }).catchError((e, st) {
30 busy = false; 32 error = e.message;
31 }); 33 app.handleException(e, st);
34 }).whenComplete(() {
35 busy = false;
36 });
32 } 37 }
33 } 38 }
34 } 39 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/eval_box.html ('k') | runtime/observatory/lib/src/elements/eval_link.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698