Error handling

Last Updated: Oct 13, 2017

Exception handling

If a request error occurs when OSS C SDK is used, the corresponding error message will be 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.

Timeout handing

How to judge timeout

  • If the code in the returned aos_status_t is “5XX”, it indicates an internal server error. You can 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 timeout. You can 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 timeout value

  • Set the connection timeout value: Options > CTl > Options > Connect_timeout. Unit: seconds. The default value is 10 seconds.
  • Set the DNS timeout value: Options > CTl > Options > DNS_cache_timeout. Unit: seconds. The default value is 60 seconds.
  • Set the request timeout 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 above default values are used, it indicates that if the transmission speed is less than 1K for 15 consecutive seconds, the system will deem 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 Illegal 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.