contents   index   previous   next



seThrow

 

syntax:

   void

seThrow(secontext se,seconstcharptr message,

                     ...);

where:

se the current context

 

message the message of the error message in standard ScriptEase format.

 

... printf-style arguments

 

return:

None

 

description:

An error object is constructed and set up in the SE_RETURN object. In addition, the error flag is turned on. If the wrapper function calling seThrow returns after this call, it’s result will be the given error.

 

The standard error message format for ScriptEase allows information on the type of the error to be included. By default, a stock Exception object is constructed with the text passed to this function. The extended form of the string is:

 

!TYPE NUM: MESSAGE

 

For instance, you could pass:

 

!SyntaxError 9999: You made a mistake.

 

 

 

The TYPE indicates the type of the error. An error object of this type is constructed to contain the error. The error types are:

 

SyntaxError

 

ReferenceError

 

ConversionError

 

ArrayLengthError

 

TypeError

 

URIError

 

EvalError

 

RegExpError

 

These types are defined by ECMA, including what errors are generated in normal error situations. When writing your own wrapper functions, pick the error type you feel is most appropriate.

 

The NUM indicates a resource number for your error message. Values of 10000 or more are reserved for user errors, and you should use one. These numbers are used by the seGetResourceFunc to internationalize the text associated with various text strings, including error messages.

 

MESSAGE is the text of the error message.

 

When the internal exception object is generated (for seThrow exceptions or any internally generated exception), these properties of that object are created:

 

name - Name of the exception class, e.g. "SyntaxError"

message - text of error, e.g. "9999: You made a mistake."

fileName - Name of the source file where error occurred, if available, e.g. "c:\foo\myscript.jsa"

lineNum - Line number if file where error occurred, if available, e.g. "173"

functionName - Name of executing function where error occurred, if available, e.g. "foobar"

see:

None

 


EXECUTING SCRIPTS