Click or drag to resize
ServiceException Class

表示阿里云服务返回的错误消息。

ServiceException用于处理阿里云服务返回的错误消息。 比如,用于身份验证的AccessKeyID不存在,则会抛出ServiceException。 异常中包含了错误代码,用于让调用者进行特定的处理。

WebException表示的则是在向阿里云服务发送请求时出现的错误。 例如,在发送请求时网络连接不可用,则会抛出WebException的异常。

InvalidOperationException表示客户端代码无法处理或解析返回结果。这种情况 有可能是服务器返回的结果不完整,或不再符合SDK设计时的规范。如果持续遇到该错误,请考虑升级 SDK版本,或联系我们。

通常来讲,调用者只需要处理ServiceException。因为该异常表明请求被服务处理, 但处理的结果表明存在错误。异常中包含了细节的信息,特别是错误代码,可以帮助调用者进行处理。

Inheritance Hierarchy

Namespace: Aliyun.OSS.Common
Assembly: Aliyun.OSS (in Aliyun.OSS.dll) Version: 2.5.1.0 (2.5.1)
Syntax
[SerializableAttribute]
public class ServiceException : Exception

The ServiceException type exposes the following members.

Constructors
  NameDescription
Public methodServiceException
初始化新的ServiceException实例。
Public methodServiceException(String)
初始化新的ServiceException实例。
Protected methodServiceException(SerializationInfo, StreamingContext)
初始化新的ServiceException实例。
Public methodServiceException(String, Exception)
初始化新的ServiceException实例。
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetBaseException
When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.
(Inherited from Exception.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetObjectData (Overrides ExceptionGetObjectData(SerializationInfo, StreamingContext).)
Public methodGetType
Gets the runtime type of the current instance.
(Inherited from Exception.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Creates and returns a string representation of the current exception.
(Inherited from Exception.)
Top
Properties
  NameDescription
Public propertyData
Gets a collection of key/value pairs that provide additional user-defined information about the exception.
(Inherited from Exception.)
Public propertyErrorCode
获取错误代码。
Public propertyHelpLink
Gets or sets a link to the help file associated with this exception.
(Inherited from Exception.)
Public propertyHostId
获取Host ID。
Protected propertyHResult
Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.
(Inherited from Exception.)
Public propertyInnerException
Gets the Exception instance that caused the current exception.
(Inherited from Exception.)
Public propertyMessage
Gets a message that describes the current exception.
(Inherited from Exception.)
Public propertyRequestId
获取Request ID。
Public propertySource
Gets or sets the name of the application or the object that causes the error.
(Inherited from Exception.)
Public propertyStackTrace
Gets a string representation of the frames on the call stack at the time the current exception was thrown.
(Inherited from Exception.)
Public propertyTargetSite
Gets the method that throws the current exception.
(Inherited from Exception.)
Top
See Also