Hi everyone,
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!
Hi @Mike684
I think this should work:
@GeometryView("test", duration_guess=1)
def test_error(self, params, **kwargs):
try:
geometry = Sphere(Point(0, 0), "this should be a number")
return GeometryResult(geometry)
except TypeError as e:
raise UserError(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’.

2 Likes
Thank you Paulien, I switched TypeError for ValueError and that worked well.
1 Like