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

Side by Side Diff: pkg/analysis_server/lib/src/protocol.dart

Issue 419833004: Send 'server.error' notification in case of an exception during performing an operation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 protocol; 5 library protocol;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert' show JsonDecoder; 8 import 'dart:convert' show JsonDecoder;
9 9
10 import 'package:analysis_services/json.dart'; 10 import 'package:analysis_services/json.dart';
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 */ 893 */
894 void setParameter(String name, Object value) { 894 void setParameter(String name, Object value) {
895 params[name] = _toJson(value); 895 params[name] = _toJson(value);
896 } 896 }
897 897
898 /** 898 /**
899 * Return a table representing the structure of the Json object that will be 899 * Return a table representing the structure of the Json object that will be
900 * sent to the client to represent this response. 900 * sent to the client to represent this response.
901 */ 901 */
902 Map<String, Object> toJson() { 902 Map<String, Object> toJson() {
903 Map<String, Object> jsonObject = new HashMap<String, Object>(); 903 Map<String, Object> jsonObject = {};
904 jsonObject[EVENT] = event; 904 jsonObject[EVENT] = event;
905 if (!params.isEmpty) { 905 if (!params.isEmpty) {
906 jsonObject[PARAMS] = params; 906 jsonObject[PARAMS] = params;
907 } 907 }
908 return jsonObject; 908 return jsonObject;
909 } 909 }
910 } 910 }
911 911
912 /** 912 /**
913 * Instances of the class [RequestHandler] implement a handler that can handle 913 * Instances of the class [RequestHandler] implement a handler that can handle
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 */ 945 */
946 _toJson(Object value) { 946 _toJson(Object value) {
947 if (value is HasToJson) { 947 if (value is HasToJson) {
948 return value.toJson(); 948 return value.toJson();
949 } 949 }
950 if (value is Iterable) { 950 if (value is Iterable) {
951 return value.map((item) => _toJson(item)).toList(); 951 return value.map((item) => _toJson(item)).toList();
952 } 952 }
953 return value; 953 return value;
954 } 954 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | pkg/analysis_services/lib/constants.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698