mirror of
https://github.com/tiqi-group/pydase.git
synced 2026-02-13 05:48:40 +01:00
Merge pull request #254 from tiqi-group/fix/serialize_exception
fix: serialize exception
This commit is contained in:
@@ -158,7 +158,7 @@ class Serializer:
|
|||||||
"doc": None,
|
"doc": None,
|
||||||
"readonly": True,
|
"readonly": True,
|
||||||
"type": "Exception",
|
"type": "Exception",
|
||||||
"value": obj.args[0],
|
"value": obj.args[0] if len(obj.args) > 0 else "",
|
||||||
"name": obj.__class__.__name__,
|
"name": obj.__class__.__name__,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1225,3 +1225,22 @@ def test_add_prefix_to_full_access_path(
|
|||||||
serialized_obj: SerializedObject, prefix: str, expected: SerializedObject
|
serialized_obj: SerializedObject, prefix: str, expected: SerializedObject
|
||||||
) -> None:
|
) -> None:
|
||||||
assert add_prefix_to_full_access_path(serialized_obj, prefix) == expected
|
assert add_prefix_to_full_access_path(serialized_obj, prefix) == expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_serialize_exception() -> None:
|
||||||
|
assert dump(Exception()) == {
|
||||||
|
"doc": None,
|
||||||
|
"full_access_path": "",
|
||||||
|
"name": "Exception",
|
||||||
|
"readonly": True,
|
||||||
|
"type": "Exception",
|
||||||
|
"value": "",
|
||||||
|
}
|
||||||
|
assert dump(Exception("Exception message")) == {
|
||||||
|
"doc": None,
|
||||||
|
"full_access_path": "",
|
||||||
|
"name": "Exception",
|
||||||
|
"readonly": True,
|
||||||
|
"type": "Exception",
|
||||||
|
"value": "Exception message",
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user