Line: Integer;
The Line property returns the number of the line, during the execution of which an exception is thrown.
Sub UserProc;
Var
a: Array[0..1] Of Integer;
Ex: IException;
Begin
Try
a[2] := 1;
Except On e: IndexOutOfRangeException Do
Debug.WriteLine("---Error---");
Debug.WriteLine(e.Message);
Debug.WriteLine(e.Source);
Debug.WriteLine(e.Line);
Ex := e.NestedException;
Debug.WriteLine("---Error that caused current exception---");
Debug.WriteLine(Ex.Source);
Debug.WriteLine(Ex.Line);
End Try;
End Sub UserProc;
After executing the example the error "Invalid element index!" will be generated. When this error is handled, the error text, identifier of the unit or form, and line number, in which the error was generated, will be displayed, as well as the file name and the line number, in which this exception is handled.
See also: