| OLD | NEW |
| 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 | 579 |
| 580 /** | 580 /** |
| 581 * Initialize a newly created instance to represent an error condition caused | 581 * Initialize a newly created instance to represent an error condition caused |
| 582 * by a `analysis.updateOptions` [request] that includes an unknown analysis | 582 * by a `analysis.updateOptions` [request] that includes an unknown analysis |
| 583 * option. | 583 * option. |
| 584 */ | 584 */ |
| 585 Response.unknownOptionName(Request request, String optionName) | 585 Response.unknownOptionName(Request request, String optionName) |
| 586 : this(request.id, new RequestError(-12, 'Unknown analysis option: "$optionN
ame"')); | 586 : this(request.id, new RequestError(-12, 'Unknown analysis option: "$optionN
ame"')); |
| 587 | 587 |
| 588 /** | 588 /** |
| 589 * Initialize a newly created instance to represent an error condition caused |
| 590 * by an error during `analysis.getErrors`. |
| 591 */ |
| 592 Response.getErrorsError(Request request, String message) |
| 593 : this( |
| 594 request.id, |
| 595 new RequestError(-13, 'Error during `analysis.getErrors`: $message.')); |
| 596 |
| 597 /** |
| 589 * Initialize a newly created instance based upon the given JSON data | 598 * Initialize a newly created instance based upon the given JSON data |
| 590 */ | 599 */ |
| 591 factory Response.fromJson(Map<String, Object> json) { | 600 factory Response.fromJson(Map<String, Object> json) { |
| 592 try { | 601 try { |
| 593 Object id = json[Response.ID]; | 602 Object id = json[Response.ID]; |
| 594 if (id is! String) { | 603 if (id is! String) { |
| 595 return null; | 604 return null; |
| 596 } | 605 } |
| 597 Object error = json[Response.ERROR]; | 606 Object error = json[Response.ERROR]; |
| 598 Object result = json[Response.RESULT]; | 607 Object result = json[Response.RESULT]; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 /** | 707 /** |
| 699 * An error code indicating an internal error. | 708 * An error code indicating an internal error. |
| 700 */ | 709 */ |
| 701 static const int CODE_INTERNAL_ERROR = -32603; | 710 static const int CODE_INTERNAL_ERROR = -32603; |
| 702 | 711 |
| 703 /** | 712 /** |
| 704 * An error code indicating a problem using the specified Dart SDK. | 713 * An error code indicating a problem using the specified Dart SDK. |
| 705 */ | 714 */ |
| 706 static const int CODE_SDK_ERROR = -32603; | 715 static const int CODE_SDK_ERROR = -32603; |
| 707 | 716 |
| 717 /** |
| 718 * An error code indicating a problem during 'analysis.getErrors'. |
| 719 */ |
| 720 static const int CODE_ANALISYS_GET_ERRORS_ERROR = -32500; |
| 721 |
| 708 /* | 722 /* |
| 709 * In addition, codes -32000 to -32099 indicate a server error. They are | 723 * In addition, codes -32000 to -32099 indicate a server error. They are |
| 710 * reserved for implementation-defined server-errors. | 724 * reserved for implementation-defined server-errors. |
| 711 */ | 725 */ |
| 712 | 726 |
| 713 /** | 727 /** |
| 714 * The code that uniquely identifies the error that occurred. | 728 * The code that uniquely identifies the error that occurred. |
| 715 */ | 729 */ |
| 716 final int code; | 730 final int code; |
| 717 | 731 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 */ | 945 */ |
| 932 _toJson(Object value) { | 946 _toJson(Object value) { |
| 933 if (value is HasToJson) { | 947 if (value is HasToJson) { |
| 934 return value.toJson(); | 948 return value.toJson(); |
| 935 } | 949 } |
| 936 if (value is Iterable) { | 950 if (value is Iterable) { |
| 937 return value.map((item) => _toJson(item)).toList(); | 951 return value.map((item) => _toJson(item)).toList(); |
| 938 } | 952 } |
| 939 return value; | 953 return value; |
| 940 } | 954 } |
| OLD | NEW |