ModuleServiceProxy.GetErrorInformation Method

Definition

Retrieves error information.

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

Parameters

ex
Exception

The Exception thrown.

resourceManager
ResourceManager

A ResourceManager object.

errorText
String

When this method returns, contains the name of the resource associated with the exception. This parameter is passed uninitialized.

errorMessage
String

When this method returns, contains the error message associated with the exception. This parameter is passed uninitialized.

Returns

The value of the ResourceName property.

Exceptions

The ex parameter or resourceManager parameter is null.

Examples

The following example demonstrates the GetErrorInformation method.

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);
}

Applies to