Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
6.5.1.1
-
None
Description
If your QML application binds to a property that raises an exception, the application crashes with a segfault. Is there any way this could be handled more gracefully, either on the python side or on the QML side?
As a simple example, you can simply bind to a property like:
@Property(str, constant=True) def my_property(self): raise ValueError
As soon as QML needs to read that property, python will raise the exception, and the app will crash with a segfault. In order to avoid this, you could wrap every single property in a try-except that scrubs all exceptions, but that would be a mess on a large existing project. Is there somewhere that the @Property decorator could be modified to handle exceptions? And by "handle exceptions" here, I don't mean do anything particularly special. That would be up to the developer, but some uncontroversial thing like just letting python print a traceback before crashing would be an improvement, otherwise the user doesn't get any feedback about what happened and it's hard for a developer to track down.
In fact, even just printing an error in the QML console would work.