I’m wondering if there is a way to display geometry’s ValueError as a warning message in the VIKTOR UI and if so, how.
To elaborate, I’m building an app that allows user to define an arc using coordinates. If the start and endpoints (accidentally) coincide, there is a warning message displayed in my developer powershell.
ValueError: Start and end point may not coincide
In the GeometryView only this message is displayed, which isn’t particularly helpful for users:
Thanks in advance!
I think this should work:
def test_error(self, params, **kwargs):
geometry = Sphere(Point(0, 0), "this should be a number")
except TypeError as e:
It does not show you the type of error, but shows the error message to the user. In your case, you’d check for a
ValueError instead of a
TypeError, and it will display ‘Start and end point may not coincide’.
Thank you Paulien, I switched TypeError for ValueError and that worked well.