ModuleService.RaiseException Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Throws a WebManagementServiceException.
Overloads
RaiseException(Exception) | |
RaiseException(String) |
Throws a WebManagementServiceException based on the specified resource name. |
RaiseException(String, String) |
Throws a WebManagementServiceException based on the specified resource name and error message. |
RaiseException(Exception)
protected:
void RaiseException(Exception ^ ex);
protected void RaiseException (Exception ex);
member this.RaiseException : Exception -> unit
Protected Sub RaiseException (ex As Exception)
Parameters
- ex
- Exception
Applies to
RaiseException(String)
Throws a WebManagementServiceException based on the specified resource name.
protected:
void RaiseException(System::String ^ resourceName);
protected void RaiseException (string resourceName);
member this.RaiseException : string -> unit
Protected Sub RaiseException (resourceName As String)
Parameters
- resourceName
- String
A string that contains the exception message.
Examples
The following example uses the RaiseException(String) method to throw a WebManagementServiceException when the AllowUntrustedProviders property is false
.
void verifyUnTrusted() {
if (ManagementUnit.Administration.AllowUntrustedProviders == false)
RaiseException("AllowUntrustedProviders required");
}
void DisplayWebMgmntSrvceEx(WebManagementServiceException ex) {
string msg = ex.ResourceName;
if (string.IsNullOrEmpty(ex.Message) != true)
msg += " \n Message \n" + ex.Message;
MessageBox.Show(msg, ex.Source);
}
void DisplayExceptionString(Exception ex) {
if (ex is WebManagementServiceException) {
DisplayWebMgmntSrvceEx((WebManagementServiceException)ex);
return;
}
string errAll = string.Empty, errTxt = string.Empty, errMsg = string.Empty;
string s = ModuleServiceProxy.GetErrorInformation(ex, _resourceMgr, out errTxt, out errMsg);
errAll = ex.Message + "\n ModuleServiceProxy.GetErrorInformation return \n\t\"" + s +
" \"\n\t Error Text = " +
errTxt + "\n \t Error Msg = " + errMsg;
if (ex.InnerException != null && ex.InnerException.Message != null
&& ex.InnerException.Message != "")
errAll += "\n\n ************ InnerException ************ \n" +
ex.InnerException.Message +
"\n ************ End InnerException ************ \n";
errAll += ex.StackTrace;
MessageBox.Show(errAll + "\n" + ex.Message, "Error in : " + ex.Source);
}
Applies to
RaiseException(String, String)
Throws a WebManagementServiceException based on the specified resource name and error message.
protected:
void RaiseException(System::String ^ resourceName, System::String ^ errorMessage);
protected void RaiseException (string resourceName, string errorMessage);
member this.RaiseException : string * string -> unit
Protected Sub RaiseException (resourceName As String, errorMessage As String)
Parameters
- resourceName
- String
A string that contains the exception resource name message.
- errorMessage
- String
A string that contains the exception message.
Examples
The following example uses the RaiseException(String, String) method to throw a WebManagementServiceException when the AllowUntrustedProviders property is false
.
void verifyUnTrusted2() {
if (ManagementUnit.Administration.AllowUntrustedProviders == false)
RaiseException("AllowUntrustedProviders required","see Config Guide");
}
void DisplayWebMgmntSrvceEx(WebManagementServiceException ex) {
string msg = ex.ResourceName;
if (string.IsNullOrEmpty(ex.Message) != true)
msg += " \n Message \n" + ex.Message;
MessageBox.Show(msg, ex.Source);
}
void DisplayExceptionString(Exception ex) {
if (ex is WebManagementServiceException) {
DisplayWebMgmntSrvceEx((WebManagementServiceException)ex);
return;
}
string errAll = string.Empty, errTxt = string.Empty, errMsg = string.Empty;
string s = ModuleServiceProxy.GetErrorInformation(ex, _resourceMgr, out errTxt, out errMsg);
errAll = ex.Message + "\n ModuleServiceProxy.GetErrorInformation return \n\t\"" + s +
" \"\n\t Error Text = " +
errTxt + "\n \t Error Msg = " + errMsg;
if (ex.InnerException != null && ex.InnerException.Message != null
&& ex.InnerException.Message != "")
errAll += "\n\n ************ InnerException ************ \n" +
ex.InnerException.Message +
"\n ************ End InnerException ************ \n";
errAll += ex.StackTrace;
MessageBox.Show(errAll + "\n" + ex.Message, "Error in : " + ex.Source);
}