Exception handling

Last Updated: Nov 03, 2017

If a request error occurs when OSS CSDK is used, the corresponding error message is the output in aos_status_s. The attributes of aos_status_s include:

  • code: The HTTP error code of the error request. The value is an integer.
  • error_code: The OSS error code, a string.
  • error_msg: The OSS error information, a string.
  • req_id: The UUID that identifies the request. If you cannot solve the problem, you can seek help from OSS development engineers by providing the req_id. The value is a string.

Time-out handling

How to determine a time-out

  • If the code in the returned aos_status_t is “5XX”, it indicates an internal server error. Try again.

  • If the code in the returned aos_status_t is not “2XX” and the error_code is “-992” or “-995”, it indicates a connection or request time-out. Try again.

  • You can use the aos_should_retry(aos_status_t *) in the aos_status.h to determine whether the error code returned requires a retry. If “1” is returned, a retry is required.

How to set the time-out value

  • Set the connection time-out value: Options > CTl > Options > Connect_timeout. Unit: seconds. The default value is 10 seconds.

  • Set the DNS time-out value: Options > CTl > Options > DNS_cache_timeout. Unit: seconds. The default value is 60 seconds.

  • Set the request time-out value:

    • You can set Options > CTl > Options > Speed_limit value to control the allowed minimum speed. The default value is 1024 or 1K.
    • You can set Options > CTl > Options > Speed_time value to control the allowed maximum duration. The default value is 15 seconds.
    • If the preceding default values are used, it indicates that if the transmission speed is less than 1K for 15 consecutive seconds, the system deems the request timed out.

Common error codes

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 Pre-processing 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.