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

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

Issue 513853002: In the analysis server API, change RequestError.code to an enum. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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 // This file has been automatically generated. Please do not edit it manually. 5 // This file has been automatically generated. Please do not edit it manually.
6 // To regenerate the file, use the script 6 // To regenerate the file, use the script
7 // "pkg/analysis_server/spec/generate_files". 7 // "pkg/analysis_server/spec/generate_files".
8 8
9 part of protocol; 9 part of protocol;
10 /** 10 /**
(...skipping 5649 matching lines...) Expand 10 before | Expand all | Expand 10 after
5660 @override 5660 @override
5661 String toString() => "ElementKind.$name"; 5661 String toString() => "ElementKind.$name";
5662 5662
5663 String toJson() => name; 5663 String toJson() => name;
5664 } 5664 }
5665 5665
5666 /** 5666 /**
5667 * Error 5667 * Error
5668 * 5668 *
5669 * { 5669 * {
5670 * "code": String 5670 * "code": RequestErrorCode
5671 * "message": String 5671 * "message": String
5672 * "data": optional object 5672 * "data": optional object
5673 * } 5673 * }
5674 */ 5674 */
5675 class Error { 5675 class Error {
5676 /** 5676 /**
5677 * A code that uniquely identifies the error that occurred. 5677 * A code that uniquely identifies the error that occurred.
5678 */ 5678 */
5679 String code; 5679 RequestErrorCode code;
5680 5680
5681 /** 5681 /**
5682 * A short description of the error. 5682 * A short description of the error.
5683 */ 5683 */
5684 String message; 5684 String message;
5685 5685
5686 /** 5686 /**
5687 * Additional data related to the error. This field is omitted if there is no 5687 * Additional data related to the error. This field is omitted if there is no
5688 * additional data available. 5688 * additional data available.
5689 */ 5689 */
5690 Object data; 5690 Object data;
5691 5691
5692 Error(this.code, this.message, {this.data}); 5692 Error(this.code, this.message, {this.data});
5693 5693
5694 factory Error.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) { 5694 factory Error.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json) {
5695 if (json == null) { 5695 if (json == null) {
5696 json = {}; 5696 json = {};
5697 } 5697 }
5698 if (json is Map) { 5698 if (json is Map) {
5699 String code; 5699 RequestErrorCode code;
5700 if (json.containsKey("code")) { 5700 if (json.containsKey("code")) {
5701 code = jsonDecoder._decodeString(jsonPath + ".code", json["code"]); 5701 code = new RequestErrorCode.fromJson(jsonDecoder, jsonPath + ".code", js on["code"]);
5702 } else { 5702 } else {
5703 throw jsonDecoder.missingKey(jsonPath, "code"); 5703 throw jsonDecoder.missingKey(jsonPath, "code");
5704 } 5704 }
5705 String message; 5705 String message;
5706 if (json.containsKey("message")) { 5706 if (json.containsKey("message")) {
5707 message = jsonDecoder._decodeString(jsonPath + ".message", json["message "]); 5707 message = jsonDecoder._decodeString(jsonPath + ".message", json["message "]);
5708 } else { 5708 } else {
5709 throw jsonDecoder.missingKey(jsonPath, "message"); 5709 throw jsonDecoder.missingKey(jsonPath, "message");
5710 } 5710 }
5711 Object data; 5711 Object data;
5712 if (json.containsKey("data")) { 5712 if (json.containsKey("data")) {
5713 data = json["data"]; 5713 data = json["data"];
5714 } 5714 }
5715 return new Error(code, message, data: data); 5715 return new Error(code, message, data: data);
5716 } else { 5716 } else {
5717 throw jsonDecoder.mismatch(jsonPath, "Error"); 5717 throw jsonDecoder.mismatch(jsonPath, "Error");
5718 } 5718 }
5719 } 5719 }
5720 5720
5721 Map<String, dynamic> toJson() { 5721 Map<String, dynamic> toJson() {
5722 Map<String, dynamic> result = {}; 5722 Map<String, dynamic> result = {};
5723 result["code"] = code; 5723 result["code"] = code.toJson();
5724 result["message"] = message; 5724 result["message"] = message;
5725 if (data != null) { 5725 if (data != null) {
5726 result["data"] = data; 5726 result["data"] = data;
5727 } 5727 }
5728 return result; 5728 return result;
5729 } 5729 }
5730 5730
5731 @override 5731 @override
5732 String toString() => JSON.encode(toJson()); 5732 String toString() => JSON.encode(toJson());
5733 5733
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after
8075 8075
8076 @override 8076 @override
8077 int get hashCode { 8077 int get hashCode {
8078 int hash = 0; 8078 int hash = 0;
8079 hash = _JenkinsSmiHash.combine(hash, 114870849); 8079 hash = _JenkinsSmiHash.combine(hash, 114870849);
8080 return _JenkinsSmiHash.finish(hash); 8080 return _JenkinsSmiHash.finish(hash);
8081 } 8081 }
8082 } 8082 }
8083 8083
8084 /** 8084 /**
8085 * RequestErrorCode
8086 *
8087 * enum {
8088 * GET_ERRORS_ERROR
8089 * INVALID_PARAMETER
8090 * INVALID_REQUEST
8091 * SERVER_ALREADY_STARTED
8092 * UNANALYZED_PRIORITY_FILES
8093 * UNKNOWN_REQUEST
8094 * UNSUPPORTED_FEATURE
8095 * }
8096 */
8097 class RequestErrorCode {
8098 /**
8099 * An error occurred during the processing of an "analysis.getErrors"
8100 * request.
8101 */
8102 static const GET_ERRORS_ERROR = const RequestErrorCode._("GET_ERRORS_ERROR");
8103
8104 /**
8105 * One of the method parameters was invalid.
8106 */
8107 static const INVALID_PARAMETER = const RequestErrorCode._("INVALID_PARAMETER") ;
8108
8109 /**
8110 * A malformed request was received.
8111 */
8112 static const INVALID_REQUEST = const RequestErrorCode._("INVALID_REQUEST");
8113
8114 /**
8115 * The analysis server has already been started (and hence won't accept new
8116 * connections).
8117 */
8118 static const SERVER_ALREADY_STARTED = const RequestErrorCode._("SERVER_ALREADY _STARTED");
8119
8120 /**
8121 * An "analysis.setPriorityFiles" request includes one or more files that are
8122 * not being analyzed.
8123 */
8124 static const UNANALYZED_PRIORITY_FILES = const RequestErrorCode._("UNANALYZED_ PRIORITY_FILES");
8125
8126 /**
8127 * A request was received which the analysis server does not recognize, or
8128 * cannot handle in its current configuation.
8129 */
8130 static const UNKNOWN_REQUEST = const RequestErrorCode._("UNKNOWN_REQUEST");
8131
8132 /**
8133 * The analysis server was requested to perform an action which is not
8134 * supported.
8135 */
8136 static const UNSUPPORTED_FEATURE = const RequestErrorCode._("UNSUPPORTED_FEATU RE");
8137
8138 final String name;
8139
8140 const RequestErrorCode._(this.name);
8141
8142 factory RequestErrorCode(String name) {
8143 switch (name) {
8144 case "GET_ERRORS_ERROR":
8145 return GET_ERRORS_ERROR;
8146 case "INVALID_PARAMETER":
8147 return INVALID_PARAMETER;
8148 case "INVALID_REQUEST":
8149 return INVALID_REQUEST;
8150 case "SERVER_ALREADY_STARTED":
8151 return SERVER_ALREADY_STARTED;
8152 case "UNANALYZED_PRIORITY_FILES":
8153 return UNANALYZED_PRIORITY_FILES;
8154 case "UNKNOWN_REQUEST":
8155 return UNKNOWN_REQUEST;
8156 case "UNSUPPORTED_FEATURE":
8157 return UNSUPPORTED_FEATURE;
8158 }
8159 throw new Exception('Illegal enum value: $name');
8160 }
8161
8162 factory RequestErrorCode.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob ject json) {
8163 if (json is String) {
8164 try {
8165 return new RequestErrorCode(json);
8166 } catch(_) {
8167 // Fall through
8168 }
8169 }
8170 throw jsonDecoder.mismatch(jsonPath, "RequestErrorCode");
8171 }
8172
8173 @override
8174 String toString() => "RequestErrorCode.$name";
8175
8176 String toJson() => name;
8177 }
8178
8179 /**
8085 * SearchResult 8180 * SearchResult
8086 * 8181 *
8087 * { 8182 * {
8088 * "location": Location 8183 * "location": Location
8089 * "kind": SearchResultKind 8184 * "kind": SearchResultKind
8090 * "isPotential": bool 8185 * "isPotential": bool
8091 * "path": List<Element> 8186 * "path": List<Element>
8092 * } 8187 * }
8093 */ 8188 */
8094 class SearchResult { 8189 class SearchResult {
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
9680 return false; 9775 return false;
9681 } 9776 }
9682 9777
9683 @override 9778 @override
9684 int get hashCode { 9779 int get hashCode {
9685 int hash = 0; 9780 int hash = 0;
9686 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); 9781 hash = _JenkinsSmiHash.combine(hash, newName.hashCode);
9687 return _JenkinsSmiHash.finish(hash); 9782 return _JenkinsSmiHash.finish(hash);
9688 } 9783 }
9689 } 9784 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698