Excellent! Halfway there.

Ruud, can you confirm that this is intended to work by design rather than accident

If so the manual needs an update to clarify the action as it currently states the exit "Exits the current KiXtart script", which it doesn't in the case of an exit in a UDF.

We're still stuck with the standard error strings when calling the @SERROR macro though. How about a user defined error message number (65535 maybe?), and change the exit command to accept an arbitrary error message so you could do:

code:
 exit 65535,"Fatal error in UDF"

I've just found in testing that a "RETURN" resets @ERROR, so if you have nested functions you need to:

code:
FUNCTION MyFunction()
$Return=MyOtherFunction(Foo)
if @ERROR exit @ERROR endif
...
return
ENDFUNCTION

------------------
Richard Howarth

[This message has been edited by rhowarth (edited 15 May 2001).]