OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.convert; | 5 part of dart.convert; |
6 | 6 |
7 /** | 7 /** |
8 * Error thrown by JSON serialization if an object cannot be serialized. | 8 * Error thrown by JSON serialization if an object cannot be serialized. |
9 * | 9 * |
10 * The [unsupportedObject] field holds that object that failed to be serialized. | 10 * The [unsupportedObject] field holds that object that failed to be serialized. |
(...skipping 16 matching lines...) Expand all Loading... |
27 return "Converting object to an encodable object failed."; | 27 return "Converting object to an encodable object failed."; |
28 } else { | 28 } else { |
29 return "Converting object did not return an encodable object."; | 29 return "Converting object did not return an encodable object."; |
30 } | 30 } |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 /** | 34 /** |
35 * Reports that an object could not be stringified due to cyclic references. | 35 * Reports that an object could not be stringified due to cyclic references. |
36 * | 36 * |
37 * An object that references itself cannot be serialized by [stringify]. | 37 * An object that references itself cannot be serialized by |
| 38 * [JsonCodec.encode]/[JsonEncoder.convert]. |
38 * When the cycle is detected, a [JsonCyclicError] is thrown. | 39 * When the cycle is detected, a [JsonCyclicError] is thrown. |
39 */ | 40 */ |
40 class JsonCyclicError extends JsonUnsupportedObjectError { | 41 class JsonCyclicError extends JsonUnsupportedObjectError { |
41 /** The first object that was detected as part of a cycle. */ | 42 /** The first object that was detected as part of a cycle. */ |
42 JsonCyclicError(Object object) : super(object); | 43 JsonCyclicError(Object object) : super(object); |
43 String toString() => "Cyclic error in JSON stringify"; | 44 String toString() => "Cyclic error in JSON stringify"; |
44 } | 45 } |
45 | 46 |
46 /** | 47 /** |
47 * An instance of the default implementation of the [JsonCodec]. | 48 * An instance of the default implementation of the [JsonCodec]. |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 buffer.setRange(index, end, indent); | 1050 buffer.setRange(index, end, indent); |
1050 index = end; | 1051 index = end; |
1051 } else { | 1052 } else { |
1052 for (int i = 0; i < indentLength; i++) { | 1053 for (int i = 0; i < indentLength; i++) { |
1053 writeByte(indent[i]); | 1054 writeByte(indent[i]); |
1054 } | 1055 } |
1055 } | 1056 } |
1056 } | 1057 } |
1057 } | 1058 } |
1058 } | 1059 } |
OLD | NEW |