Re: Error Handler

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi, Alex.

Perhaps you were expecting some sort of "catch" or "throw" (as in ARDI's
Prolog, for example).

No such luck. If there is a run-time error, Euphoria:

1. Displays an error message.
2. Creates an error file called EX.ERR.
3. Aborts.

Typically, you will get a run-time error from trying using the wrong data
type (an integer instead of a sequence, for example).

You can control what is displayed in the error message by using
crash_message().

The contents of EX.ERR will vary, depending on:

1. If you are using the Public Domain version and are less than 300 lines,
and
2. If you had TRACE active.

I *think* that Robert's logic is that since something bad has happened,
allowing the program to continue to run will only produce worse results.

In my mind, the "sudden death" error handling is perhaps one of Euphoria's
remaining major weaknesses. For example, if there is an error in an editor
written in Euphoria, the program will simply abort, losing all the data.

People have requested that Robert add some sort of user-defined error
handling be added. I was hoping that version 2.0 might include it. I'd love
the option to be able to say:

   errorHandler = routine_id( "MyErrorHandler" )

But as of now, no such option is available. One option is to write your own
versions of primary routines, and do extensive error checking. The most
typical reason for my own code to fail is to request a item past the upper
or lower bounds of a sequence.

Did this answer your question?

-- David Cuny

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu