Exception handling

If a request error occurs in the use of OSS C SDK, the corresponding error message is output in aos_status_s. The attributes of aos_status_s include:

Error code Description Type
code The HTTP status code of the error request Integer
error_code Error code returned by OSS Character string
error_msg Error message returned by OSS Character string
req_id The UUID that identifies the request. You can provide the req_id to OSS development engineers for further help. Character string

Timeout handling

If the code in the returned aos_status_t is not “2XX”, and the error_code is -992 or -995, it indicates a connection timeout error or a request timeout error occurs. You can try again.

You can use the aos_should_retry(aos_status_t *) in the aos_status.h to determine whether the returned error code requires a retry. If the returned value is 1, you must try again.

Common error codes

Error code Description HTTP status code
AccessDenied Access denied 403
BucketAlreadyExists The bucket already exists. 409
BucketNotEmpty The bucket is not empty. 409
EntityTooLarge The entity size exceeds the maximum limit. 400
EntityTooSmall The entity size is below the minimum limit. 400
FileGroupTooLarge The total file group size exceeds the maximum limit. 400
FilePartNotExist The file part does not exist. 400
FilePartStale The file part has expired. 400
InvalidArgument The parameter format is invalid. 400
InvalidAccessKeyId The AccessKeyId does not exist. 403
InvalidBucketName The bucket name is invalid. 400
InvalidDigest The digest is invalid. 400
InvalidObjectName The object name is invalid. 400
InvalidPart The part is invalid. 400
InvalidPartOrder The part order is invalid. 400
InvalidTargetBucketForLogging The buckets that store log files are invalid. 400
InternalError Internal OSS error 500
MalformedXML The XML format is invalid. 400
MethodNotAllowed The method is not supported. 405
MissingArgument Parameters are not configured. 411
MissingContentLength The content length is not configured. 411
NoSuchBucket The bucket does not exist. 404
NoSuchKey The object does not exist 404
NoSuchUpload The multipart upload ID does not exist. 404
NotImplemented The method cannot be processed. 501
PreconditionFailed Pre-processing error. 412
RequestTimeTooSkewed The local time set for OSSClient is deviated from the time set for the OSS server by over 15 minutes. 403
RequestTimeout Request timeout 400
SignatureDoesNotMatch Signature mismatch 403
TooManyBuckets The number of buckets exceed the limits,. 400