how can we display an error and either halt code execution or exit from that procedure or function after clearing the error? I’m not sure how to handle this in code but is there a way to detect if an error occurred?A:
It very much depends what the error is. ON ERROR is designed so that developers can handle errors in the way appropriate to their application. When an error occurs, the command assigned to ON ERROR – usually a call to a user-defined error handler function – is run and the error handler can check the current status: error number, procedure name, line number, dbf(), eof() etc. Based on this information, the error handler is designed to resolve the situation, logs details (I think Hank mentionedSAVE ERROR somewhere along the line) and/or exit (QUIT) if a resolution is not possible (bearing in mind that other events are still going on). The ON ERROR can be defined in the App init() to be active in Runtime mode (Lianja.Isruntimemode()) or to behave differently depending on whether you are in Runtime mode or not. Its behaviour can be changed by reissuing ON ERROR with a different command and its current setting queried with ON(“ERROR”).
Within a procedure or function, TRY/CATCH may well be appropriate to handle a particular block of code.
Also, don’t forget that the App Inspector can be seen in both Development and Runtime View in the App Builder (switch it on in Dev View) so that you can have the Error tab visible as you test.
If you get any strange behavior like this then SET DEBUG ON and attach the debug.txt file from the debug directory with your ticket. It tells us what line in our code threw the error.
In Lianja App builder when I click to open ‘Lianja Demo App’ it seems that it tries to open it as indicated by a progress line bar on top bar but it closes the App builder without any error.
If the Lianja demo app crashes on loading it that sounds like you have previously had Python installed on your machine OR you have RoboForm installed that interferes with the GUI events being dispatched by windows.