Skip to content

Commit b89fa4c

Browse files
rquiduteandy31415
andauthored
Cherrypick #39597 into v1.4.2-branch (#39766)
* Convert and log complex exceptions as simple Exception with stacktrace in on_fail (#39597) * Simplify exception on_fail * Improve code comment * restyled * Convert complex exceptions to simple Exception * Restyled * Added missing import traceback * Restyled * Undo changes in matter_testing.py and add __reduce__ in chip.exceptions at __init__.py --------- Co-authored-by: Andrei Litvin <[email protected]> * Code review --------- Co-authored-by: Andrei Litvin <[email protected]>
1 parent 98483e5 commit b89fa4c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/controller/python/chip/exceptions/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,19 @@
3535

3636

3737
class ChipStackException(Exception):
38-
pass
38+
def __reduce__(self):
39+
"""
40+
Allows this exception to be pickled by returning a simplified Exception
41+
with the same message, ensuring it can be safely transferred across
42+
processes in multiprocessing environments.
43+
44+
Note:
45+
This replaces the custom exception with a plain Exception during
46+
pickling, preserving the message but not the exception type, to avoid
47+
import errors in environments where this exception class is unavailable.
48+
"""
49+
50+
return (Exception, (str(self),))
3951

4052

4153
class ChipStackError(ChipStackException):

0 commit comments

Comments
 (0)