Share via


Number プロパティ

特定のスクリプト エラーを表すエラー番号をレポートします。

Object.Number

引数

  • Object
    WshRemoteError オブジェクトです。

解説

Number プロパティは符号なし長整数を返します。

使用例

次のコードは、WshRemoteError オブジェクトがエラー番号を公開する例です。

VBScript

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 " & theError.Number & " - Line: " & theError.Line & ", Char: " & theError.Character & vbCrLf & "Description: " & theError.Description
    WScript.Quit -1
End Sub

JScript

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 " + theError.Number + " - Line: " + theError.Line + ", Char: " + theError.Character + "\nDescription: " + theError.Description);    
    WScript.Quit(-1);
}

参照

WshRemote オブジェクト | WshRemoteError オブジェクト | Description プロパティ | Line プロパティ | Character プロパティ| SourceText プロパティ| Source プロパティ