Handling Errors in Perspective

In Perspective, I have had trouble with errors not being raised to the user. If I am in a Designer and I execute a button click or something, any errors will pop up in an Error window and print to the console. But if I launch a browser to that page, errors are not raised to be visible to the user.

If I were to set up a data entry screen and then create a Submit button using a button component, I would set up some scripting in the onActionPerformed event of that button to send the data to the database. If there was some problem inserting into the database, the user would not know.

What is the typical method for setting up error handling so that the user would find out there is a problem in this example?

If it’s something you need to alert the user about, I would wrap your logic in a try/except block, and in the exception handling you should use system.perspective.openPopup(). You’ll want to create a View which is able to convey information to the user, whether it the stacktrace or just a warning that something failed.

2 Likes

That sounds simple enough, thank you.