| 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:convert' show JsonDecoder; | 7 import 'dart:convert' show JsonDecoder; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Instances of the class [Request] represent a request that was received. | 10 * Instances of the class [Request] represent a request that was received. |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 Response.unknownAnalysisOption(Request request, String optionName) | 258 Response.unknownAnalysisOption(Request request, String optionName) |
| 259 : this(request.id, new RequestError(-6, 'Unknown analysis option: "$optionNa
me"')); | 259 : this(request.id, new RequestError(-6, 'Unknown analysis option: "$optionNa
me"')); |
| 260 | 260 |
| 261 /** | 261 /** |
| 262 * Initialize a newly created instance to represent an error condition caused | 262 * Initialize a newly created instance to represent an error condition caused |
| 263 * by a [request] that cannot be handled by any known handlers. | 263 * by a [request] that cannot be handled by any known handlers. |
| 264 */ | 264 */ |
| 265 Response.unknownRequest(Request request) | 265 Response.unknownRequest(Request request) |
| 266 : this(request.id, new RequestError(-7, 'Unknown request')); | 266 : this(request.id, new RequestError(-7, 'Unknown request')); |
| 267 | 267 |
| 268 Response.contextAlreadyExists(Request request) |
| 269 : this(request.id, new RequestError(-8, 'Context already exists')); |
| 270 |
| 268 /** | 271 /** |
| 269 * Initialize a newly created instance based upon the given JSON data | 272 * Initialize a newly created instance based upon the given JSON data |
| 270 */ | 273 */ |
| 271 factory Response.fromJson(Map<String, Object> json) { | 274 factory Response.fromJson(Map<String, Object> json) { |
| 272 try { | 275 try { |
| 273 var id = json[Response.ID]; | 276 var id = json[Response.ID]; |
| 274 if (id is! String) { | 277 if (id is! String) { |
| 275 return null; | 278 return null; |
| 276 } | 279 } |
| 277 var error = json[Response.ERROR]; | 280 var error = json[Response.ERROR]; |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 /** | 600 /** |
| 598 * The response to be returned as a result of the failure. | 601 * The response to be returned as a result of the failure. |
| 599 */ | 602 */ |
| 600 final Response response; | 603 final Response response; |
| 601 | 604 |
| 602 /** | 605 /** |
| 603 * Initialize a newly created exception to return the given reponse. | 606 * Initialize a newly created exception to return the given reponse. |
| 604 */ | 607 */ |
| 605 RequestFailure(this.response); | 608 RequestFailure(this.response); |
| 606 } | 609 } |
| OLD | NEW |