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 /** | 5 /** |
6 * Support for client code that needs to interact with the requests, responses | 6 * Support for client code that needs to interact with the requests, responses |
7 * and notifications that are part of the analysis server's wire protocol. | 7 * and notifications that are part of the analysis server's wire protocol. |
8 */ | 8 */ |
9 library analysis_server.plugin.protocol.protocol; | 9 library analysis_server.plugin.protocol.protocol; |
10 | 10 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 /** | 332 /** |
333 * Initialize a newly created instance to represent a response to a request | 333 * Initialize a newly created instance to represent a response to a request |
334 * with the given [id]. If [_result] is provided, it will be used as the | 334 * with the given [id]. If [_result] is provided, it will be used as the |
335 * result; otherwise an empty result will be used. If an [error] is provided | 335 * result; otherwise an empty result will be used. If an [error] is provided |
336 * then the response will represent an error condition. | 336 * then the response will represent an error condition. |
337 */ | 337 */ |
338 Response(this.id, {Map<String, Object> result, this.error}) | 338 Response(this.id, {Map<String, Object> result, this.error}) |
339 : _result = result; | 339 : _result = result; |
340 | 340 |
341 /** | 341 /** |
| 342 * Create and return the `DEBUG_PORT_COULD_NOT_BE_OPENED` error response. |
| 343 */ |
| 344 Response.debugPortCouldNotBeOpened(Request request, dynamic error) |
| 345 : this(request.id, |
| 346 error: new RequestError( |
| 347 RequestErrorCode.DEBUG_PORT_COULD_NOT_BE_OPENED, '$error')); |
| 348 |
| 349 /** |
342 * Initialize a newly created instance to represent the FILE_NOT_ANALYZED | 350 * Initialize a newly created instance to represent the FILE_NOT_ANALYZED |
343 * error condition. | 351 * error condition. |
344 */ | 352 */ |
345 Response.fileNotAnalyzed(Request request, String file) | 353 Response.fileNotAnalyzed(Request request, String file) |
346 : this(request.id, | 354 : this(request.id, |
347 error: new RequestError(RequestErrorCode.FILE_NOT_ANALYZED, | 355 error: new RequestError(RequestErrorCode.FILE_NOT_ANALYZED, |
348 'File is not analyzed: $file.')); | 356 'File is not analyzed: $file.')); |
349 | 357 |
350 /** | 358 /** |
351 * Initialize a newly created instance to represent the FORMAT_INVALID_FILE | 359 * Initialize a newly created instance to represent the FORMAT_INVALID_FILE |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 jsonObject[ID] = id; | 589 jsonObject[ID] = id; |
582 if (error != null) { | 590 if (error != null) { |
583 jsonObject[ERROR] = error.toJson(); | 591 jsonObject[ERROR] = error.toJson(); |
584 } | 592 } |
585 if (_result != null) { | 593 if (_result != null) { |
586 jsonObject[RESULT] = _result; | 594 jsonObject[RESULT] = _result; |
587 } | 595 } |
588 return jsonObject; | 596 return jsonObject; |
589 } | 597 } |
590 } | 598 } |
OLD | NEW |