How to display errors when using LiveCode Server
When developing on the server it is vital that you get as much error information as possible. LiveCode Server has a really handy little switch that allows you to tell LiveCode Server to output error messages right there in the browser.
Set the errorMode to 'inline'
1) SETUP YOUR ERROR MESSAGES
The screenshot shows the source of a webpage I am working on. Place the following line of script at the top of your LiveCode script. It must be on the first line and surrounded by standard "<?lc" and "?>" tags.
set the errorMode to "inline"
All error messages will now be output directly to the browser.
2) START CODING
As you can see I have entered an invalid line of code. When I go to my webpage an error message should be displayed.
The result
The errors have been output direct to my webpage in the browser.
Other error modes
The error mode specifies the action the engine takes when an error occurs. The errorMode property can be set to one of 4 types
debugger - is for information only and indicates that the script is being run in 'remote debug' mode. This is only relevant to the on-rev engine
inline - indicates that the error should be output into the stdout stream. In this case, the engine assumes that the output is HTML and puts the error messages in a 'pre' block
stderr - specifies that the error should be written out to stderr
quiet - indicates that nothing is output anywhere when an error occurs



Now I know how to display the errors.
But I also want to treat the error message in the script of iRev file.
Please tell me how this can be done.
Best Regards,
H
To handle errors within your script files, you can use try catch blocks. For example:
try
...
your code
...
catch tError
...
error handling
...
end try
Warm Regards
Michael
Add your comment