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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 jsonObject[ERROR] = error.toJson(); | 320 jsonObject[ERROR] = error.toJson(); |
321 } | 321 } |
322 if (!result.isEmpty) { | 322 if (!result.isEmpty) { |
323 jsonObject[RESULT] = result; | 323 jsonObject[RESULT] = result; |
324 } | 324 } |
325 return jsonObject; | 325 return jsonObject; |
326 } | 326 } |
327 } | 327 } |
328 | 328 |
329 /** | 329 /** |
330 * Instances of the class [RequestError] represent information about an error th
at | 330 * Instances of the class [RequestError] represent information about an error |
331 * occurred while attempting to respond to a [Request]. | 331 * that occurred while attempting to respond to a [Request]. |
332 */ | 332 */ |
333 class RequestError { | 333 class RequestError { |
334 /** | 334 /** |
335 * The name of the JSON attribute containing the code that uniquely identifies | 335 * The name of the JSON attribute containing the code that uniquely identifies |
336 * the error that occurred. | 336 * the error that occurred. |
337 */ | 337 */ |
338 static const String CODE = 'code'; | 338 static const String CODE = 'code'; |
339 | 339 |
340 /** | 340 /** |
341 * The name of the JSON attribute containing an object with additional data | 341 * The name of the JSON attribute containing an object with additional data |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 /** | 584 /** |
585 * The response to be returned as a result of the failure. | 585 * The response to be returned as a result of the failure. |
586 */ | 586 */ |
587 final Response response; | 587 final Response response; |
588 | 588 |
589 /** | 589 /** |
590 * Initialize a newly created exception to return the given reponse. | 590 * Initialize a newly created exception to return the given reponse. |
591 */ | 591 */ |
592 RequestFailure(this.response); | 592 RequestFailure(this.response); |
593 } | 593 } |
OLD | NEW |