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

Unified Diff: runtime/observatory/lib/src/elements/nav_bar.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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/nav_bar.dart
diff --git a/runtime/observatory/lib/src/elements/nav_bar.dart b/runtime/observatory/lib/src/elements/nav_bar.dart
index 411346fbcc1d643784f6d0db91e5de564ec47215..04c5fce475d55fa0abcb329fa11def870ed6b9d9 100644
--- a/runtime/observatory/lib/src/elements/nav_bar.dart
+++ b/runtime/observatory/lib/src/elements/nav_bar.dart
@@ -13,7 +13,7 @@ import 'package:polymer/polymer.dart';
@CustomTag('nav-bar')
class NavBarElement extends ObservatoryElement {
- @published bool showNotify = true;
+ @published bool notifyOnPause = true;
@published bool pad = true;
NavBarElement.created() : super.created();
@@ -36,9 +36,11 @@ class NavMenuItemElement extends ObservatoryElement {
NavMenuItemElement.created() : super.created();
}
+typedef Future RefreshCallback();
+
@CustomTag('nav-refresh')
class NavRefreshElement extends ObservatoryElement {
- @published var callback;
+ @published RefreshCallback callback;
@published bool active = false;
@published String label = 'Refresh';
@@ -50,7 +52,9 @@ class NavRefreshElement extends ObservatoryElement {
}
active = true;
if (callback != null) {
- callback(refreshDone);
+ callback()
+ .catchError(app.handleException)
+ .whenComplete(refreshDone);
}
}
@@ -100,36 +104,49 @@ class ClassNavMenuElement extends ObservatoryElement {
@CustomTag('nav-notify')
class NavNotifyElement extends ObservatoryElement {
- @published ObservableList<ServiceEvent> events;
+ @published ObservableList<Notification> notifications;
+ @published bool notifyOnPause = true;
NavNotifyElement.created() : super.created();
}
-@CustomTag('nav-notify-item')
-class NavNotifyItemElement extends ObservatoryElement {
- @published ObservableList<ServiceEvent> events;
+@CustomTag('nav-notify-event')
+class NavNotifyEventElement extends ObservatoryElement {
+ @published ObservableList<Notification> notifications;
+ @published Notification notification;
@published ServiceEvent event;
+ @published bool notifyOnPause = true;
- Future resume(_) {
- app.removePauseEvents(event.isolate);
- return event.isolate.resume();
+ void closeItem(MouseEvent e, var detail, Element target) {
+ notifications.remove(notification);
}
- Future stepInto(_) {
- app.removePauseEvents(event.isolate);
- return event.isolate.stepInto();
+
+ NavNotifyEventElement.created() : super.created();
+}
+
+@CustomTag('nav-notify-exception')
+class NavNotifyExceptionElement extends ObservatoryElement {
+ @published ObservableList<Notification> notifications;
+ @published Notification notification;
+ @published var exception;
+ @published var stacktrace;
+
+ exceptionChanged() {
+ notifyPropertyChange(#isNetworkError, true, false);
+ notifyPropertyChange(#isUnexpectedError, true, false);
}
- Future stepOver(_) {
- app.removePauseEvents(event.isolate);
- return event.isolate.stepOver();
+
+ @observable get isNetworkError {
+ return (exception is NetworkRpcException);
}
- Future stepOut(_) {
- app.removePauseEvents(event.isolate);
- return event.isolate.stepOut();
+
+ @observable get isUnexpectedError {
+ return (exception is! NetworkRpcException);
}
void closeItem(MouseEvent e, var detail, Element target) {
- events.remove(event);
+ notifications.remove(notification);
}
- NavNotifyItemElement.created() : super.created();
+ NavNotifyExceptionElement.created() : super.created();
}
« no previous file with comments | « runtime/observatory/lib/src/elements/metrics.dart ('k') | runtime/observatory/lib/src/elements/nav_bar.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698