Skip to content

Commit 4e2a821

Browse files
authored
Accept SE-0489 (#2927)
Updating the text to remove implementation details for which the language steering group would encourage further change separately from the Evolution process.
1 parent 86a3bf6 commit 4e2a821

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

proposals/0489-codable-error-printing.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* Proposal: [SE-0489](0489-codable-error-printing.md)
44
* Authors: [Zev Eisenberg](https://github.com/ZevEisenberg)
55
* Review Manager: [Xiaodi Wu](https://github.com/xwu)
6-
* Status: **Active review (July 9...22, 2025)**
6+
* Status: **Accepted**
77
* Implementation: https://github.com/swiftlang/swift/pull/80941
8-
* Review: ([pitch](https://forums.swift.org/t/pitch-improve-encodingerror-and-decodingerror-s-printed-descriptions/79872)) ([review](https://forums.swift.org/t/se-0489-improve-encodingerror-and-decodingerrors-printed-descriptions/81021))
8+
* Review: ([pitch](https://forums.swift.org/t/pitch-improve-encodingerror-and-decodingerror-s-printed-descriptions/79872)) ([review](https://forums.swift.org/t/se-0489-improve-encodingerror-and-decodingerrors-printed-descriptions/81021)) ([acceptance](https://forums.swift.org/t/accepted-se-0489-improve-encodingerror-and-decodingerrors-printed-descriptions/81380))
99

1010
## Introduction
1111

@@ -71,19 +71,13 @@ However, it is not easy or pleasant to read such an error, particularly when dea
7171

7272
## Proposed solution
7373

74-
Conform `EncodingError` and `DecodingError` to `CustomDebugStringConvertible` and provide a clean, readable debug description for each. Here is an example of the proposed change for the same decoding error as above.
75-
76-
```
77-
Key 'population' not found in keyed decoding container.
78-
Debug description: No value associated with key CodingKeys(stringValue: "population", intValue: nil) ("population").
79-
Path: [0]/home/country
80-
```
74+
Conform `EncodingError` and `DecodingError` to `CustomDebugStringConvertible` and provide a clean, readable debug description for each.
8175

8276
Complete examples of the before/after diffs are available in the description of the [implementation pull request](https://github.com/swiftlang/swift/pull/80941) that accompanies this proposal.
8377

84-
**Note 1:** this proposal is _not_ intended to specify an exact output format. The above is provided as an example, and is not a guarantee of current or future behavior. You are still free to inspect the contents of thrown errors directly if you need to detect specific problems.
78+
**Note 1:** This proposal is _not_ intended to specify an exact output format, and any examples are not a guarantee of current or future behavior. You are still free to inspect the contents of thrown errors directly if you need to detect specific problems.
8579

86-
**Note 2:** the output could be further improved by modifying `JSONDecoder` to write a better debug description. See [Future Directions](#future-directions) for more.
80+
**Note 2:** The output could be further improved by modifying `JSONDecoder` to write a better debug description. See [Future Directions](#future-directions) for more.
8781

8882
## Detailed design
8983

@@ -127,7 +121,7 @@ It is technically possible to backdeploy the `debugDescription` property, but wi
127121

128122
### Better error generation from Foundation encoders/decoders
129123

130-
The debug descriptions generated in Foundation sometimes contain the same information as the new debug descriptions from this proposal. A future change to the standard JSON and Plist encoders and decoders could provide more compact debug descriptions once they can be sure they have the new standard library descriptions available. They could also use a more compact description when rendering the description of a `CodingKey`. Using part of the example from above:
124+
The debug descriptions generated in Foundation sometimes contain the same information as the new debug descriptions from this proposal. A future change to the standard JSON and Plist encoders and decoders could provide more compact debug descriptions once they can be sure they have the new standard library descriptions available. They could also use a more compact description when rendering the description of a `CodingKey`. Take, for example:
131125

132126
```
133127
Debug description: No value associated with key CodingKeys(stringValue: "population", intValue: nil) ("population").

0 commit comments

Comments
 (0)