| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 /** | 346 /** |
| 347 * The name of the JSON attribute containing a short description of the error. | 347 * The name of the JSON attribute containing a short description of the error. |
| 348 */ | 348 */ |
| 349 static const String MESSAGE = 'message'; | 349 static const String MESSAGE = 'message'; |
| 350 | 350 |
| 351 /** | 351 /** |
| 352 * An error code indicating a parse error. Invalid JSON was received by the | 352 * An error code indicating a parse error. Invalid JSON was received by the |
| 353 * server. An error occurred on the server while parsing the JSON text. | 353 * server. An error occurred on the server while parsing the JSON text. |
| 354 */ | 354 */ |
| 355 static const int CODE_PARSE_ERROR = -32700; | 355 static const int CODE_PARSE_ERROR = -32700; |
| 356 |
| 357 /** |
| 358 * An error code indicating that the analysis server has already been |
| 359 * started (and hence won't accept new connections). |
| 360 */ |
| 361 static const int CODE_SERVER_ALREADY_STARTED = -32701; |
| 356 | 362 |
| 357 /** | 363 /** |
| 358 * An error code indicating an invalid request. The JSON sent is not a valid | 364 * An error code indicating an invalid request. The JSON sent is not a valid |
| 359 * [Request] object. | 365 * [Request] object. |
| 360 */ | 366 */ |
| 361 static const int CODE_INVALID_REQUEST = -32600; | 367 static const int CODE_INVALID_REQUEST = -32600; |
| 362 | 368 |
| 363 /** | 369 /** |
| 364 * An error code indicating a method not found. The method does not exist or | 370 * An error code indicating a method not found. The method does not exist or |
| 365 * is not currently available. | 371 * is not currently available. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 RequestError(this.code, this.message); | 413 RequestError(this.code, this.message); |
| 408 | 414 |
| 409 /** | 415 /** |
| 410 * Initialize a newly created [Error] to indicate a parse error. Invalid JSON | 416 * Initialize a newly created [Error] to indicate a parse error. Invalid JSON |
| 411 * was received by the server. An error occurred on the server while parsing | 417 * was received by the server. An error occurred on the server while parsing |
| 412 * the JSON text. | 418 * the JSON text. |
| 413 */ | 419 */ |
| 414 RequestError.parseError() : this(CODE_PARSE_ERROR, "Parse error"); | 420 RequestError.parseError() : this(CODE_PARSE_ERROR, "Parse error"); |
| 415 | 421 |
| 416 /** | 422 /** |
| 423 * Initialize a newly created [Error] to indicate that the analysis server |
| 424 * has already been started (and hence won't accept new connections). |
| 425 */ |
| 426 RequestError.serverAlreadyStarted() |
| 427 : this(CODE_SERVER_ALREADY_STARTED, "Server already started"); |
| 428 |
| 429 /** |
| 417 * Initialize a newly created [Error] to indicate an invalid request. The | 430 * Initialize a newly created [Error] to indicate an invalid request. The |
| 418 * JSON sent is not a valid [Request] object. | 431 * JSON sent is not a valid [Request] object. |
| 419 */ | 432 */ |
| 420 RequestError.invalidRequest() : this(CODE_INVALID_REQUEST, "Invalid request"); | 433 RequestError.invalidRequest() : this(CODE_INVALID_REQUEST, "Invalid request"); |
| 421 | 434 |
| 422 /** | 435 /** |
| 423 * Initialize a newly created [Error] to indicate that a method was not found. | 436 * Initialize a newly created [Error] to indicate that a method was not found. |
| 424 * Either the method does not exist or is not currently available. | 437 * Either the method does not exist or is not currently available. |
| 425 */ | 438 */ |
| 426 RequestError.methodNotFound() : this(CODE_METHOD_NOT_FOUND, "Method not found"
); | 439 RequestError.methodNotFound() : this(CODE_METHOD_NOT_FOUND, "Method not found"
); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 /** | 597 /** |
| 585 * The response to be returned as a result of the failure. | 598 * The response to be returned as a result of the failure. |
| 586 */ | 599 */ |
| 587 final Response response; | 600 final Response response; |
| 588 | 601 |
| 589 /** | 602 /** |
| 590 * Initialize a newly created exception to return the given reponse. | 603 * Initialize a newly created exception to return the given reponse. |
| 591 */ | 604 */ |
| 592 RequestFailure(this.response); | 605 RequestFailure(this.response); |
| 593 } | 606 } |
| OLD | NEW |