共用方式為


ErrorCategory Enum

Definition

Errors reported by PowerShell will be in one of these categories.

public enum class ErrorCategory
public enum ErrorCategory
type ErrorCategory = 
Public Enum ErrorCategory
Inheritance
ErrorCategory

Fields

Name Value Description
NotSpecified 0

No error category is specified, or the error category is invalid.

Do not specify ErrorCategory.NotSpecified when creating an ErrorRecord. Choose the best match from among the other values.

OpenError 1
CloseError 2
DeviceError 3
DeadlockDetected 4
InvalidArgument 5
InvalidData 6
InvalidOperation 7
InvalidResult 8
InvalidType 9
MetadataError 10
NotImplemented 11
NotInstalled 12
ObjectNotFound 13

Object can not be found (file, directory, computer, system resource, etc.)

OperationStopped 14
OperationTimeout 15
SyntaxError 16
ParserError 17
PermissionDenied 18

Operation not permitted.

ResourceBusy 19
ResourceExists 20
ResourceUnavailable 21
ReadError 22
WriteError 23
FromStdErr 24

A native command reported an error to its STDERR pipe.

The Engine uses this ErrorCategory when it executes a native console applications and captures the errors reported by the native application. Avoid using ErrorCategory.FromStdErr in other circumstances.

SecurityError 25

Used for security exceptions.

ProtocolError 26

The contract of a protocol is not being followed. Should not happen with well-behaved components.

ConnectionError 27

The operation depends on a network connection that cannot be established or maintained.

AuthenticationError 28

Could not authenticate the user to the service. Could mean that the credentials are invalid or the authentication system is not functioning properly.

LimitsExceeded 29

Internal limits prevent the operation from being executed.

QuotaExceeded 30

Controls on the use of traffic or resources prevent the operation from being executed.

NotEnabled 31

The operation attempted to use functionality that is currently disabled.

Remarks

Do not specify ErrorCategory.NotSpecified when creating an ErrorRecord. Choose the best match from among the other values.

Applies to