ErrorDetails Constructors

Definition

Overloads

ErrorDetails(String)

Creates an instance of ErrorDetails specifying a Message.

ErrorDetails(SerializationInfo, StreamingContext)

Initializes a new instance of the ErrorDetails class using data serialized via ISerializable

ErrorDetails(Cmdlet, String, String, Object[])

Creates an instance of ErrorDetails specifying a Message. This variant is used by cmdlets.

ErrorDetails(IResourceSupplier, String, String, Object[])

Creates an instance of ErrorDetails specifying a Message. This variant is used by CmdletProviders.

ErrorDetails(Assembly, String, String, Object[])

Creates an instance of ErrorDetails specifying a Message. This variant is used by other code without a reference to a Cmdlet or CmdletProvider instance.

ErrorDetails(String)

Creates an instance of ErrorDetails specifying a Message.

public:
 ErrorDetails(System::String ^ message);
public:
 ErrorDetails(Platform::String ^ message);
 ErrorDetails(std::wstring const & message);
public ErrorDetails (string message);
new System.Management.Automation.ErrorDetails : string -> System.Management.Automation.ErrorDetails
Public Sub New (message As String)

Parameters

message
String

Remarks

It is preferred for Cmdlets to use ErrorDetails(Cmdlet, String, String, Object[]), for CmdletProviders to use ErrorDetails(IResourceSupplier, String, String, Object[]), and for other localizable code to use ErrorDetails(Assembly, String, String, Object[]) where possible.

Applies to

ErrorDetails(SerializationInfo, StreamingContext)

Initializes a new instance of the ErrorDetails class using data serialized via ISerializable

protected:
 ErrorDetails(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected ErrorDetails (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Management.Automation.ErrorDetails : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Management.Automation.ErrorDetails
Protected Sub New (info As SerializationInfo, context As StreamingContext)

Parameters

info
SerializationInfo

Serialization information.

context
StreamingContext

Streaming context.

Applies to

ErrorDetails(Cmdlet, String, String, Object[])

Creates an instance of ErrorDetails specifying a Message. This variant is used by cmdlets.

public:
 ErrorDetails(System::Management::Automation::Cmdlet ^ cmdlet, System::String ^ baseName, System::String ^ resourceId, ... cli::array <System::Object ^> ^ args);
public ErrorDetails (System.Management.Automation.Cmdlet cmdlet, string baseName, string resourceId, params object[] args);
new System.Management.Automation.ErrorDetails : System.Management.Automation.Cmdlet * string * string * obj[] -> System.Management.Automation.ErrorDetails
Public Sub New (cmdlet As Cmdlet, baseName As String, resourceId As String, ParamArray args As Object())

Parameters

cmdlet
Cmdlet

Cmdlet containing the template string.

baseName
String

by default, the ResourceManager name

resourceId
String

by default, the resourceId in the ResourceManager

Remarks

This variant is a shortcut to build an instance of ErrorDetails reducing the steps which localizable code generally has to duplicate when it generates a localizable string. This variant is preferred over ErrorDetails(String), since the improved information about the error may help enable future scenarios.

This constructor first loads the error message template string using GetResourceString(String, String). The default implementation of GetResourceString(String, String) will load a string resource from the cmdlet assembly using baseName and resourceId; however, specific cmdlets can override this behavior by overriding virtual method GetResourceString(String, String). This constructor then inserts the specified args using Format(IFormatProvider, String, Object[]).

Applies to

ErrorDetails(IResourceSupplier, String, String, Object[])

Creates an instance of ErrorDetails specifying a Message. This variant is used by CmdletProviders.

public:
 ErrorDetails(System::Management::Automation::IResourceSupplier ^ resourceSupplier, System::String ^ baseName, System::String ^ resourceId, ... cli::array <System::Object ^> ^ args);
public ErrorDetails (System.Management.Automation.IResourceSupplier resourceSupplier, string baseName, string resourceId, params object[] args);
new System.Management.Automation.ErrorDetails : System.Management.Automation.IResourceSupplier * string * string * obj[] -> System.Management.Automation.ErrorDetails
Public Sub New (resourceSupplier As IResourceSupplier, baseName As String, resourceId As String, ParamArray args As Object())

Parameters

resourceSupplier
IResourceSupplier

Resource supplier, most often an instance of CmdletProvider.

baseName
String

by default, the ResourceManager name

resourceId
String

by default, the resourceId in the ResourceManager

Remarks

This variant is a shortcut to build an instance of ErrorDetails reducing the steps which localizable code generally has to duplicate when it generates a localizable string. This variant is preferred over ErrorDetails(String), since the improved information about the error may help enable future scenarios.

This constructor first loads a template string using GetResourceString(String, String). The default implementation of GetResourceString(String, String) will load a string resource from the CmdletProvider assembly using baseName and resourceId; however, specific CmdletProviders can override this behavior by overriding virtual method GetResourceString(String, String), and it is also possible that PSSnapin custom classes which are not instances of CmdletProvider will implement IResourceSupplier. The constructor then inserts the specified args using Format(IFormatProvider, String, Object[]).

Applies to

ErrorDetails(Assembly, String, String, Object[])

Creates an instance of ErrorDetails specifying a Message. This variant is used by other code without a reference to a Cmdlet or CmdletProvider instance.

public:
 ErrorDetails(System::Reflection::Assembly ^ assembly, System::String ^ baseName, System::String ^ resourceId, ... cli::array <System::Object ^> ^ args);
public ErrorDetails (System.Reflection.Assembly assembly, string baseName, string resourceId, params object[] args);
new System.Management.Automation.ErrorDetails : System.Reflection.Assembly * string * string * obj[] -> System.Management.Automation.ErrorDetails
Public Sub New (assembly As Assembly, baseName As String, resourceId As String, ParamArray args As Object())

Parameters

assembly
Assembly

assembly containing the template string

baseName
String

by default, the ResourceManager name

resourceId
String

by default, the resourceId in the ResourceManager

Remarks

This variant is a shortcut to build an instance of ErrorDetails reducing the steps which localizable code generally has to duplicate when it generates a localizable string. This variant is preferred over ErrorDetails(String), since the improved information about the error may help enable future scenarios.

This constructor first loads a template string from the assembly using GetString(String). The constructor then inserts the specified args using Format(IFormatProvider, String, Object[]).

Applies to