Skip to content

Commit 0c5f968

Browse files
committed
Mention that Error::description() is unimportant
1 parent 1bd903f commit 0c5f968

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/interoperability.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,12 @@ impl Error for DoError { /* ... */ }
269269
The error message given by the `Display` representation of an error type should
270270
be lowercase without trailing punctuation, and typically concise.
271271

272+
The message given by [`Error::description()`] does not matter. Users should
273+
always use `Display` instead of `description()` to print the error. A low-effort
274+
description like `"JSON error"` is sufficient.
275+
276+
[`Error::description()`]: https://doc.rust-lang.org/std/error/trait.Error.html#tymethod.description
277+
272278
### Examples from the standard library
273279

274280
- [`ParseBoolError`] is returned when failing to parse a bool from a string.

0 commit comments

Comments
 (0)