SDK Custom Exceptions
You can identify whether a request is successful through error in the response. If error is null, the request is successful; otherwise, the request fail and the error information will be displayed in the window. Sample code is as follows:
static OBSClient *client;
NSString *endPoint = @"your-endpoint";
NSString *SK = @"*** Provide your Secret Key ***";
NSString *AK = @"*** Provide your Access Key ***";
// Initialize identity authentication.
OBSStaticCredentialProvider *credentialProvider = [[OBSStaticCredentialProvider alloc] initWithAccessKey:AK secretKey:SK];
//Initialize service configuration.
OBSServiceConfiguration *conf = [[OBSServiceConfiguration alloc] initWithURLString:endPoint credentialProvider:credentialProvider];
// Initialize an instance of OBSClient.
client = [[OBSClient alloc] initWithConfiguration:conf];
// Initiate a request.
OBSListBucketsRequest *request = [OBSListBucketsRequest new];
[client listBuckets:request completionHandler:^(OBSListBucketsResponse *response, NSError *error) {
// The request is successful and the error information is null.
if(!error){
//Process the request.
NSLog(@"%@",response.headers);
}
}]; Last Article: OBS Server-Side Error Codes
Next Article: SDK Common Response Headers
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.