ErrorAsText

The ErrorAsText function retrieves the textual description of an error based on its internal error number. This can be accessed through the TRY/CATCH custom error handler.

Category: Error Handling


Syntax:
    string = ErrorAsText( number ErrorNumber )


Description:

The ErrorAsText function returns a string representing the error generated by the running procedure or active page based on its internal error number. The TRY/CATCH method can be added to a function or active page to create a custom error handler. In this way when an error occurs the CATCH function will be called with an Error object passed in as its sole parameter. Error information can be accessed via this Error object and utilized within the program.


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