Exception handling
Updated at:2025-11-03
BOS exception prompts are available in the following two ways:
| Exception type | Description |
|---|---|
| BceClientException | Client exception |
| BceServiceException | Server exception |
Users can use try to obtain the exception generated by a certain event, e.g.:
C#
1String objectKey = "testObjectToFile";
2bosclient.putObject(bucketName, objectKey, "dataFile");
3File file = new File("test");
4try{
5 bosclient.getObject(this.bucketName, objectKey, file);
6 } catch (BceServiceException bce){
7 System.out.println(bce.getMessage());
8 } catch ( BceClientException bce){
9 System.out.println( bce.getMessage());
10 } finally {
11 file.delete();
12 }
