Line Property (WshRemoteError)
Identifies the line in a script that contains an error.
Syntax
Object.Line
Arguments
- Object
WshRemoteError object.
Remarks
The Line property returns an unsigned long integer.
Notice that some errors do not occur on a particular line. For example, consider the error Expected End If. In this case, there is no line (a line of code is missing). In such a case, the Line property returns zero (0).
Legacy Code Example
The following JScript code demonstrates how the WshRemoteError object exposes the line in which the error occurred.
Dim Controller, RemoteScript
Set Controller = WScript.CreateObject("WSHController")
Set RemoteScript = Controller.CreateScript("test.js", "remoteserver")
WScript.ConnectObject RemoteScript, "remote_"
RemoteScript.Execute
Do While RemoteScript.Status <> 2
WScript.Sleep 100
Loop
Sub remote_Error
Dim theError
Set theError = RemoteScript.Error
WScript.Echo "Error - Line: " & theError.Line & ", Char: " & theError.Character & vbCrLf & "Description: " & theError.Description
WScript.Quit -1
End Sub
var Controller = WScript.CreateObject("WSHController");
var RemoteScript = Controller.CreateScript("test.js", "remoteserver");
WScript.ConnectObject(RemoteScript, "remote_");
RemoteScript.Execute();
while (RemoteScript.Status != 2) {
WScript.Sleep(100);
}
function remote_Error()
{
var theError = RemoteScript.Error;
WScript.Echo("Error - Line: " + theError.Line + ", Char: " + theError.Character + "\nDescription: " + theError.Description);
WScript.Quit(-1);
}
Applies To:
See Also
WshRemote Object
Character Property
Description Property (WshRemoteError)
SourceText Property
Number Property (Windows Script Host)
Source Property (Windows Script Host)
Bookmark link 'wslrflineproperty' is broken in topic '{"project_id":"9fb4a69f-0172-4157-a999-d1266f74240f","entity_id":"e60dcf7b-3507-4cf4-b652-cc2f21cf88ca","entity_type":"Article","locale":"en-US"}'. Rebuilding the topic '{"project_id":"9fb4a69f-0172-4157-a999-d1266f74240f","entity_id":"e60dcf7b-3507-4cf4-b652-cc2f21cf88ca","entity_type":"Article","locale":"en-US"}' may solve the problem.