次の方法で共有


ModuleServiceProxy.GetErrorInformation メソッド

定義

エラー情報を取得します。

public:
 static System::String ^ GetErrorInformation(Exception ^ ex, System::Resources::ResourceManager ^ resourceManager, [Runtime::InteropServices::Out] System::String ^ % errorText, [Runtime::InteropServices::Out] System::String ^ % errorMessage);
public static string GetErrorInformation (Exception ex, System.Resources.ResourceManager resourceManager, out string errorText, out string errorMessage);
static member GetErrorInformation : Exception * System.Resources.ResourceManager *  *  -> string

パラメーター

ex
Exception

Exceptionスローされた 。

resourceManager
ResourceManager

ResourceManager オブジェクト。

errorText
String

このメソッドが戻るとき、 には、例外に関連付けられているリソースの名前が含まれます。 このパラメーターは初期化せずに渡されます。

errorMessage
String

このメソッドが返されると、 には例外に関連付けられているエラー メッセージが含まれます。 このパラメーターは初期化せずに渡されます。

戻り値

ResourceName プロパティの値。

例外

ex パラメーターまたは resourceManager パラメーターが null です。

GetErrorInformationメソッドの例を次に示します。

private void GetSettingsMLP(object sender, DoWorkEventArgs e) {

    try {
        e.Result = _serviceProxy.GetSettings();
    } catch (Exception ex) {
        DisplayExceptionString(ex);
    }
}

void DisplayExceptionString(Exception ex) {

    string errAll = string.Empty, errTxt = string.Empty, errMsg = string.Empty;

    string s = ModuleServiceProxy.GetErrorInformation(ex, _resourceMgr, out errTxt, out errMsg);
    errAll = "ModuleServiceProxy.GetErrorInformation return \n\t\"" + s +
        " \"\n\t Error Text = " +
        errTxt + "\n \t Error Msg = " + errMsg;
    if (ex.InnerException != null)
        errAll += "\n\n ************ InnerException ************ \n" +
            ex.InnerException.Message +
            "\n ************ End InnerException ************ \n";
    errAll += ex.StackTrace;

    System.Windows.Forms.MessageBox.Show(errAll + "\n" + ex.Message, "Error in : " + ex.Source);
}

適用対象