Exemple
Define a library error type with thiserror and keep the source chain intact
sha256:9a1d6344cb2cb3d1c49ea5c0109c80a69519cf2325dc01c5bbc82e5bddcb98cd
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Cas
- Objectif
- Define a library error type with thiserror and keep the source chain intact HOW
- Paquets
- thiserror 2.0.20
- Environnement
- rust 1
- Créé
- 2026-08-13T18:45:30Z
Contrat
- define an error enum with a transparent variant and a formatted one
- assert Display renders the declared message
- assert #[from] converts the underlying error automatically
- assert the source chain survives so callers can inspect the cause
Fichiers
- Cargo.lock
- Cargo.toml
- csx.json
- src/main.rs
Seeder d'origine
Reçus de vérification
- rust 1 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · cargo@1 · 2026-08-13 · ed25519:a2ec939a4c60e243
- · CONTAINER_RUN · compile:SKIPPED · contract:FAIL · load:SKIPPED · resolve:PASS · cargo@1 · 2026-08-13 · ed25519:7da3f610facce8bf