Copilot SDK Rust v1.0.0-beta.9: Error Structs & Backtrace
Copilot SDK Rust v1.0.0-beta.9 refactors error handling from flat enums to struct-with-kind() pattern, making future error context additions non-breaking. Adds optional backtrace support.
TL;DR
- Rust SDK errors now use struct-with-
kind()pattern instead of flat enums - Adding error context is now non-breaking; new fields don't touch existing code
- Optional backtrace support when
RUST_BACKTRACEis set
New
- Struct-based error pattern — Errors now use structs with a
kind()method instead of#[non_exhaustive]enums, aligning with Azure SDK for Rust conventions - Backtrace support — Error struct captures optional backtrace when
RUST_BACKTRACEenvironment variable is set, improving debugging without bloating Error size
Why This Matters
- The old enum pattern made adding context data a breaking change — any new field on a variant required updates across all match arms in your codebase
- With the struct pattern, new fields are added once in the Error struct; callers who don't inspect them are unaffected
- Callers using
?propagation or simple error display don't need to call.kind()at all — only code that needs to categorize failures calls it
Breaking Changes
- Error handling code must migrate from matching enum variants directly to calling
.kind()on the error struct before pattern matching
Update via: cargo update github-copilot-sdk
Source: Copilot SDK