livecode.com
  • Home
  • Download
  • Developers
  • Academy
  • Community
  • Store
  • Support
  • About
LiveCode Lessons » How To - LiveCode Server Tasks » How to display errors when using LiveCode Server

Topics

  • Articles 0
  • Installing LiveCode Server 6
    • How do I install LiveCode Server?
    • How do I install LiveCode Server on OS X with Apache?
    • How do I install LiveCode Server on Windows with Apache?
    • How do I install LiveCode Server on Linux with Apache?
    • How do I install LiveCode Server with Apache via .htaccess?
    • How do I choose which LiveCode Server engine to use with On-Rev?
  • Using LiveCode Server 4
    • How do I add Multiple LiveCode Files in LiveCode Server?
    • How do I use stacks with LiveCode Server?
    • How to display errors when using LiveCode Server
    • Sending Emails From LiveCode Server Scripts
  • Interacting with LiveCode Server 6
    • How do I pass information to LiveCode Server scripts?
    • How do I handle user input using LiveCode Server?
    • How Do I Use AJAX with LiveCode Server?
    • How to upload a file with LiveCode Server
    • How do I use Cookies on LiveCode Server?
    • Accessing Web Services using LiveCode

Last Updated

Jul 19, 2011

Other Resources

  • Getting Started with LiveCode

  • Get Up and Running with LiveCode
  • Getting Started with LiveCode Development
  • LiveCode Concepts

  • Features, concepts and aspects of LiveCode
  • LiveCode Lessons

  • How To - Step-By-Step Guides To Tasks In LiveCode
  • How To - LiveCode Server Tasks
  • How To - LiveCode Mobile Tasks
  • How To - LiveCode Sample Scripts
  • How to - LiveCode Marketplace Products
  • How to Purchase and License LiveCode
  • Tutorials

  • Creating a Video Library Application
  • Data Grid

  • LiveCode Data Grid
  • Data Grid Tips & Tricks
  • Converting the Stock Program

Comments

2 for this lesson

  • Prev: How do I use stacks with LiveCode Server?
  • Next: Sending Emails From LiveCode Server Scripts

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

Zoom

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

  • Prev: How do I use stacks with LiveCode Server?
  • Next: Sending Emails From LiveCode Server Scripts

Comments (2)

YOKOTA Fumitaka Wednesday May 05 at 09:47 AM

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,

Michael McCreary Thursday Aug 11 at 06:49 AM

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

E-Mail me when someone replies to this comment
Brought to you by RunRev Ltd, Registered in Scotland, No. SC200728