Commit c85c43f
committed
Simplify _restore_mcp_error: every MCPError subclass inherits from_error_data
The defensive hasattr/fallback branch was unreachable in practice — every
MCPError subclass inherits from_error_data() from the base class, so the
exc_type.__new__(...) fallback path never fires. Removing it brings coverage
to 100% and keeps the reconstructor to 2 lines.
Behavior unchanged:
- MCPError pickle round-trip
- UrlElicitationRequiredError pickle round-trip (specialized path)
- Arbitrary MCPError subclass pickle round-trip
All 11 tests/shared/test_exceptions.py tests pass.1 parent 5cf4cd2 commit c85c43f
1 file changed
Lines changed: 8 additions & 9 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 18 | + | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
0 commit comments