edit-icon download-icon

Exception handling

Last Updated: Oct 27, 2017

OSS .NET SDK has two exceptions: ClientException and OSSException, which are directly or indirectly inherited from the RuntimeException.

ClientException

ClientException indicates an internal SDK exception, such as BucketName is not set, the network cannot be connected and so on.

OSSException

OSSException indicates a server error which is from parsing a server error message. OSSException generally has the following components:

  • Code: The error code OSS returns to users.

  • Message: The detailed error message provided by OSS.

  • RequestId: The UUID that uniquely identifies the request. When you cannot solve the problem, you can seek help from OSS development engineers by providing this RequestId.

  • HostId: Used to identify the accessed OSS cluster (currently unified as oss.aliyuncs.com).

The following are common OSS exceptions:

Error code Description
AccessDenied Access denied.
BucketAlreadyExists The bucket already exists.
BucketNotEmpty The bucket is not empty.
EntityTooLarge The entity is too large.
EntityTooSmall The entity is too small.
FileGroupTooLarge The object group is too large.
FilePartNotExist An object part does not exist.
FilePartStale An object part has expired.
InvalidArgument Parameter format error.
InvalidAccessKeyId The AccessKeyID does not exist.
InvalidBucketName The bucket name is invalid.
InvalidDigest The digest is invalid.
InvalidObjectName The object name is invalid.
InvalidPart A part is invalid.
InvalidPartOrder The part order is invalid.
InvalidTargetBucketForLogging The logging operation has an invalid target bucket.
InternalError Internal OSS error.
MalformedXML Invalid XML format.
MethodNotAllowed The method is not supported.
MissingArgument A parameter is missing.
MissingContentLength The content length is missing.
NoSuchBucket The bucket does not exist.
NoSuchKey The object does not exist.
NoSuchUpload The Multipart Upload ID does not exist.
NotImplemented The method cannot be processed.
PreconditionFailed Preprocessing error.
RequestTimeTooSkewed The request initiation time exceeds the server time by 15 minutes.
RequestTimeout Request timed out.
SignatureDoesNotMatch Signature error.
TooManyBuckets The user’s bucket quantity exceeds the limit.
Thank you! We've received your feedback.