We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c79b023 + 765cd2a commit 8e8e41dCopy full SHA for 8e8e41d
src/lib.rs
@@ -196,6 +196,24 @@
196
//! }
197
//! ```
198
//!
199
+//! Another use-case is making semver-resilient opaque error types:
200
+//!
201
+//! ```
202
+//! # use thiserror::Error;
203
+//! /// `LibError` is public, but opaque and easy to keep compatible.
204
+//! #[derive(Error, Debug)]
205
+//! #[error(transparent)]
206
+//! pub struct LibError(#[from] ErrorRepr);
207
208
+//! /// `ErrorRepr` is private and easy to change.
209
210
+//! enum ErrorRepr {
211
+//! # /*
212
+//! ...
213
+//! # */
214
+//! }
215
216
217
//! - See also the [`anyhow`] library for a convenient single error type to use
218
//! in application code.
219
0 commit comments