ServiceException ClassAliyun Open Services SDK for .NET

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

ServiceException用于处理阿里云服务返回的错误消息。 比如,用于身份验证的AccessKeyID不存在,则会抛出ServiceException。 (严格上讲,会是该类的一个继承类。比如,OTS服务会抛出[C:Aliyun.OpenServices.OpenTableService.OtsException])。 异常中包含了错误代码,用于让调用者进行特定的处理。

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

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

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

Inheritance Hierarchy

SystemObject
  SystemException
    Aliyun.OpenServicesServiceException
      Aliyun.OpenServices.OpenStorageServiceOssException
      Aliyun.OpenServices.OpenTableServiceOtsException

Namespace: Aliyun.OpenServices
Assembly: Aliyun.OpenServices (in Aliyun.OpenServices.dll) Version: 1.0.5290.21916
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
确定指定的 Object 是否等于当前的 Object
(Inherited from Object.)
Protected methodFinalize
允许 Object 在“垃圾回收”回收 Object 之前尝试释放资源并执行其他清理操作。
(Inherited from Object.)
Public methodGetBaseException
当在派生类中重写时,返回 Exception,它是一个或多个并发的异常的根源。
(Inherited from Exception.)
Public methodGetHashCode
用作特定类型的哈希函数。
(Inherited from Object.)
Public methodGetObjectData (Overrides ExceptionGetObjectData(SerializationInfo, StreamingContext).)
Public methodGetType
获取当前实例的运行时类型。
(Inherited from Exception.)
Protected methodMemberwiseClone
创建当前 Object 的浅表副本。
(Inherited from Object.)
Public methodToString
创建并返回当前异常的字符串表示形式。
(Inherited from Exception.)
Top
Properties

  NameDescription
Public propertyData
获取一个提供用户定义的其他异常信息的键/值对的集合。
(Inherited from Exception.)
Public propertyErrorCode
获取错误代码。
Public propertyHelpLink
获取或设置指向此异常所关联帮助文件的链接。
(Inherited from Exception.)
Public propertyHostId
获取Host ID。
Protected propertyHResult
获取或设置 HRESULT,它是分配给特定异常的编码数值。
(Inherited from Exception.)
Public propertyInnerException
获取导致当前异常的 Exception 实例。
(Inherited from Exception.)
Public propertyMessage
获取描述当前异常的消息。
(Inherited from Exception.)
Public propertyRequestId
获取Request ID。
Public propertySource
获取或设置导致错误的应用程序或对象的名称。
(Inherited from Exception.)
Public propertyStackTrace
获取当前异常发生时调用堆栈上的帧的字符串表示形式。
(Inherited from Exception.)
Public propertyTargetSite
获取引发当前异常的方法。
(Inherited from Exception.)
Top
See Also

Reference