Error Class

The Error class is automatically instantiated by the system whenever a runtime error occurs. It is accessed via the TRY/CATCH syntax.


Properties:
    number errornumError number that occured.
    number errorlineLine number within the source code where the error occured.
    string errorprocName of the procedure in which the error occured.


Description:

The Error class is automatically instantiated whenever a program or active page generates a runtime error. The TRY/CATCH functions must be used to access the error class. When an error occurs, the CATCH function is passed an instantiated Error class which can then be used to create a custom error handler. The ErrorAsText( ) function can be used to retrieve a description of the actual error from its error number.

See also: Error Functions, Error Messages


Platforms:
    Windows, DOS, Internet Active Pages


Example:
  FUNCTION main( )
    local err
    
    TRY

        x = 20
        y = 0
        
        // this generates an error
        z = x / y
        
        return( 1 )

    
    CATCH ( err )
    	local s
    	
        s =  "Error [" + err.errornum + "]"
        s += "at line #" + err.errorline
        s += " (" + ErrorAsText( err.errornum ) + ")"

        msgDelay( 3000, s )

        return( 0 )
    END

  END

  
(c) 2000-2001 by West Coast Web Adventures, Inc., All Rights Reserved