Baidu AI Cloud
中国站

百度智能云

Object Storage

Exception Handling

BOS exceptions are prompted in the following two methods:

Exception method Description
BceClientException Client exception
BceServiceException Server exception

Users can obtain the exception generated by an event with try, for example:

String objectKey = "testObjectToFile";
bosclient.putObject(bucketName, objectKey, "dataFile");
File file = new File("test");

try{
     bosclient.getObject(this.bucketName, objectKey, file);
   } catch (BceServiceException bce){
     System.out.println(bce.getMessage());
   } catch ( BceClientException bce){
     System.out.println( bce.getMessage());
   } finally {
     file.delete();
   }
Previous
Object Management
Next
Version Change Record