Commit 8f94eb6
committed
remote/client: prepare handling of multiple Errors
A future commit will introduce ClientSession code that needs to
handle multiple Error exceptions, aggregated into a dedicated group.
Python 3.11 introduced support for exception groups [1]. This allows
raising multiple exceptions (not caused by one another) while keeping
their individual tracebacks etc. intact (i.e. `labgrid-client -d` will
still show all individual tracebacks).
Since labgrid will drop Python 3.10 support in October 2026 earliest,
use the backported version of exception groups until then.
While at it, add a Error.__str__() method, so Error and ErrorGroup can
use the same print to stderr statement in the except clause.
[1] https://docs.python.org/3/library/exceptions.html#exception-groups
Signed-off-by: Bastian Krause <bst@pengutronix.de>1 parent 3b5d269 commit 8f94eb6
2 files changed
Lines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
60 | | - | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| |||
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
75 | 86 | | |
76 | 87 | | |
77 | 88 | | |
| |||
2212 | 2223 | | |
2213 | 2224 | | |
2214 | 2225 | | |
2215 | | - | |
| 2226 | + | |
2216 | 2227 | | |
2217 | 2228 | | |
2218 | 2229 | | |
2219 | | - | |
| 2230 | + | |
2220 | 2231 | | |
2221 | 2232 | | |
2222 | 2233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
0 commit comments