Run-time Errors

Top  Previous  Next

If an error is detected while a program is running, the program stops running and displays an error message in the Message Panel. The message show the type of error and location where the error occurred. For example:


Runtime: Main(Ln:4) Integer Div by Zero


Runtime errors can be turned so they don't cause the program to abort. At the same time the program can examine the error and take appropriate action. The Trap intrinsic (17) is used to disable the abort for selected run-time errors. The GetErr intrinsic is used to get information about the last error.


This is a list of all of the run-time error messages:


1: Div By 0. Illegal division by zero for an integer. If this is untrapped, 32767 is returned.


2: Out Of Memory. No more memory space. An array declaration, a Reserve, or the I2L loader tried to exceed the allotted memory bounds.


3: I/O Error. Some device driver returned with an error. The most common I/O errors are caused by forgetting to specify an input or output file on the command line, or mistyping the name of an input file.


4: Bad Opcode. Invalid opcode encountered. When this occurs, the stack is out of balance and the program has probably blown-up. It's not a bad idea to reboot your computer to be absolutely safe, although this is unnecessary if running under a protected operating system such as Windows XP. The common causes of this error are an array subscript was incorrectly computed or an intrinsic was incorrectly used.


5: Bad Intrinsic. Invalid intrinsic number used. This is usually due to an incorrect "code" declaration, but it could be caused in the same way as error 4. Some versions of the run-time code (NAT) do not support floating-point calculations and their related intrinsics (such as Fix).


6: Div By 0.0. Floating-point divide by zero. If untrapped, the largest possible real value is returned.


7: Overflow. Floating-point overflow. Some calculation exceeded the upper limit of ?1.79E+308. If untrapped, the largest possible real value is returned.


8: Underflow. Floating-point underflow. A calculation exceeded the lower limit of ?2.23E-308. If untrapped, 0.0 is returned.


9: Fix Overflow. Fixed-point overflow. Attempted to Fix too large or too small a number (greater than 65535.0 or less than -65535.0). If untrapped 32767 is returned with the appropriate sign. This error can also be caused by the Mod intrinsic if an internal calculation exceeds 15 bits of precision.


10: Sqrt < 0. Square-root error. Attempted to take the square root of a negative number. This error is also trapped by the ASin and ACos intrinsics if the argument is outside of its legal range (-1.0 <= arg <= 1.0). If untrapped, the square root of the absolute value is returned.


11: Log <= 0. Logarithm error. Attempted to take the logarithm of a number that is less than or equal to zero. If untrapped and the argument is 0.0, the smallest possible negative value is returned (minus infinity). If the argument is less than 0.0, the logarithm of the absolute value is returned.


12: Exp Overflow. Exponential error. Exp intrinsic caused an overflow. If untrapped, the largest possible value is returned.


13: Stack Error. This error indicates that there has been an error accessing the stack. This can occur if items pushed on the stack overflow the stack. Likewise, this can occur if items popped off the stack underflow the stack. It usually indicates that an intrinsic has been called with the wrong number of types of variables. It can also indicate an the returned value from an intrinsic has been assign to a variable or hasn't been assigned to the proper size of variable. Like wise, it can indicate that an intrinsic has been assign to a variable when it doesn't return a value.


14: Atan2(0.0, 0.0). ATan2(0.0, 0.0) is undefined. Returns 0.0 if untrapped.


15. Unknown Error. This error is currently unused. If you receive this error, it indicates that the program has serious errors and the run-time code has gotten itself into bad state.