Version: 2.2.1 +
In a website, errors can occur for different reasons. It is possible that certain external input is incorrect, or that there is an internal cause, an error in the implementation in Futurama. In both cases, you want to prevent that these errors will be displayed in your website, to your visitors. The formulas 'ReadError' and 'CountErrors' can serve as tools to prevent this.
The formula 'CountErrors' can be used to detect whether errors have occured in the website. It returns the total number of errors that have occured while executing the Futurama session.
After this, the formula 'ReadError' can be used, to display information about what went wrong.
Here you can choose between True or False. True if warnings are counted, False if errors are counted.
Here you can choose between True or False. True means that the number is reset to 0 after a session has ended.
For this example we create a simple and obvious error in a Futurama implementation:
Create a DataTabe with a Row and Colum count of 2. Now create an Index Formula where you refer to the DataTable, and select Row 3. This will obviously result in an error.
Create a WebPage in which you refer to the Index formula. When you visit the website, it will result in an error. Now create the formula 'CountErrors' in your webpage. This formula will return the number of errors. Create a Navigator and refer to the CountErrors formula in the condition property. If the amount of errors is greater than 0, the navigator should redirect you to a diferent wegpage.
Open your ‘WebPage’ in a browser and see the result.
Note, make sure that the reference to the formulas ‘CountErrors’ and ‘ReadError’ are at the bottom of the Futurama object 'WebPage'. This is because the browser loads the Futurama objects from top to bottom.