SPCmdlet.WriteError Method (Exception, , Object, String)
Writes the details of non-terminating errors to the screen as an error message and logs the details in a log file.
Namespace: Microsoft.SharePoint.PowerShell
Assembly: Microsoft.SharePoint.PowerShell (in Microsoft.SharePoint.PowerShell.dll)
Syntax
'Declaration
Protected Sub WriteError ( _
exception As Exception, _
category As ErrorCategory, _
target As Object, _
helpUrl As String _
)
'Usage
Dim exception As Exception
Dim category As ErrorCategory
Dim target As Object
Dim helpUrl As String
Me.WriteError(exception, category, _
target, helpUrl)
protected void WriteError(
Exception exception,
ErrorCategory category,
Object target,
string helpUrl
)
Parameters
exception
Type: System.ExceptionThe exception that indicates the non-terminating error.
category
Type: ErrorCategoryLiteral description of the error.
target
Type: System.ObjectThe instance, or its identity, that failed to process.
helpUrl
Type: System.StringA URL to an optional page that provides additional information about the error.
Remarks
When this method is called, an error record is sent to the error pipeline and then control is returned to the cmdlet to continue processing.