Skip to content

Commit 0849126

Browse files
fix: add base class to exception
pycyphal.application.file.RemoteFileError was introduced as common exception base class/tag type to catch exceptions resulting from remote file operations using the Cyphal remote file system interface. In Python exceptions must inherit from BaseException, otherwise a TypeError will occur: TypeError: exceptions must derive from BaseException RemoteFileError does not inherit from BaseException and can't thus be used in except clauses. This fix lets RemoteFileError inherit from RuntimeError, so that RemoteFileError can be used as intended. this fixes commit 40e1482 Signed-off-by: Hannes Weisbach <[email protected]>
1 parent 7cb43b5 commit 0849126

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pycyphal/application/file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ def __repr__(self) -> str:
754754
return pycyphal.util.repr_attributes(self, self._node, server_node_id=self._server_node_id)
755755

756756

757-
class RemoteFileError:
757+
class RemoteFileError(RuntimeError):
758758
"""
759759
This is a tag type used to differentiate Cyphal remote file errors.
760760
"""

0 commit comments

Comments
 (0)