Exception handling

ET

  • API Reference
    • API function release records
    • Appendix
    • Common Request Headers and Response Headers
    • Dedicated Line Related Interfaces
      • Add dedicated channel routing parameters
      • Add dedicated channel user object
      • Apply for physical dedicated line
      • Associate dedicated channel
      • Create dedicated channel
      • Create routing rules of Dedicated channel
      • Delete dedicated channel
      • Delete routing rules of dedicated channel
      • Disable dedicated channel IPv6 function
      • Disassociate dedicated channel
      • Enable IPv6 function for the dedicated channel
      • Modify the dedicated channel routing rules
      • Query dedicated channel
      • Query dedicated line details
      • Query dedicated line list
      • Query the routing rules of the dedicated channel
      • Remove dedicated channel route parameters
      • Remove dedicated channel user object
      • Resubmit the dedicated channel
      • Update dedicated channel
      • Update physical dedicated line
    • Error code
    • General Description
    • Interface Overview
    • Overview
    • Service domain
  • FAQs
    • General Problems
  • Function Release Records
  • Getting Started Guide
    • Getting Started Guide
    • On-Premises IDC and Cloud VPC Interconnection
      • Add dedicated channel
      • Add network instance
      • Apply for physical dedicated line
      • Configure user-side routing and test connectivity
      • Create dedicated gateway
  • Operation guide
    • Dedicated channel
      • Add cross-account dedicated channel
      • Add dedicated channel
      • Dedicated Channel Cross-Account Authorization for Cloud Smart Network
      • Dedicated Channel IPv6 Feature Configuration
      • Delete dedicated channel
      • Dynamic routing BGP configuration for dedicated channels
      • Static route configuration for dedicated channels
    • Dedicated gateway
      • Create dedicated gateway
      • Dedicated Gateway
    • Identity and access management
    • Monitor and Operations
      • Alarm Strategy Description
      • Dedicated Channel Instance Diagnosis
      • Fault Drill
    • Physical dedicated line
      • Apply for physical dedicated line
      • Express Tunnel process
      • Manage Physical Dedicated Line
      • Operation preparation
  • Product billing
    • Billing Item Description
    • Charge
    • Expiration description
    • Overdue description
  • Product Description
    • Application scenarios
    • Dedicated Line Access Point Address
    • Product advantages
    • Usage restrictions
    • What Is Dedicated Line Access
  • SDK
    • GO SDK
      • Dedicated line
      • Exception handling
      • Initialization
      • Install the SDK Package
      • Overview
      • Version history
    • Java-SDK
      • Dedicated line
      • Exception handling
      • Initialization
      • Install the SDK Package
      • Overview
      • Version history
    • Python SDK
      • Dedicated line
      • Function Release Records
      • Initialization
      • Install the SDK Package
      • Overview
  • Service Level Agreement (SLA)
    • Service Level Agreement (SLA)
  • Typical Practices
    • Connecting On-Premises IDC to Cloud VPC via Multi-Line ECMP (Dynamic Routing)
    • Connecting On-Premises IDC to Cloud VPC via Multi-Line ECMP (Static Routing)
    • Connecting On-Premises IDC to Cloud VPC via Primary and Backup Dedicated Lines (Dynamic Routing)
    • Connecting On-Premises IDC to Cloud VPC via Primary and Backup Dedicated Lines (Static Routing)
    • Interconnecting IDCs and VPCs Across Different Regions via Dedicated Lines
All documents
menu
No results found, please re-enter

ET

  • API Reference
    • API function release records
    • Appendix
    • Common Request Headers and Response Headers
    • Dedicated Line Related Interfaces
      • Add dedicated channel routing parameters
      • Add dedicated channel user object
      • Apply for physical dedicated line
      • Associate dedicated channel
      • Create dedicated channel
      • Create routing rules of Dedicated channel
      • Delete dedicated channel
      • Delete routing rules of dedicated channel
      • Disable dedicated channel IPv6 function
      • Disassociate dedicated channel
      • Enable IPv6 function for the dedicated channel
      • Modify the dedicated channel routing rules
      • Query dedicated channel
      • Query dedicated line details
      • Query dedicated line list
      • Query the routing rules of the dedicated channel
      • Remove dedicated channel route parameters
      • Remove dedicated channel user object
      • Resubmit the dedicated channel
      • Update dedicated channel
      • Update physical dedicated line
    • Error code
    • General Description
    • Interface Overview
    • Overview
    • Service domain
  • FAQs
    • General Problems
  • Function Release Records
  • Getting Started Guide
    • Getting Started Guide
    • On-Premises IDC and Cloud VPC Interconnection
      • Add dedicated channel
      • Add network instance
      • Apply for physical dedicated line
      • Configure user-side routing and test connectivity
      • Create dedicated gateway
  • Operation guide
    • Dedicated channel
      • Add cross-account dedicated channel
      • Add dedicated channel
      • Dedicated Channel Cross-Account Authorization for Cloud Smart Network
      • Dedicated Channel IPv6 Feature Configuration
      • Delete dedicated channel
      • Dynamic routing BGP configuration for dedicated channels
      • Static route configuration for dedicated channels
    • Dedicated gateway
      • Create dedicated gateway
      • Dedicated Gateway
    • Identity and access management
    • Monitor and Operations
      • Alarm Strategy Description
      • Dedicated Channel Instance Diagnosis
      • Fault Drill
    • Physical dedicated line
      • Apply for physical dedicated line
      • Express Tunnel process
      • Manage Physical Dedicated Line
      • Operation preparation
  • Product billing
    • Billing Item Description
    • Charge
    • Expiration description
    • Overdue description
  • Product Description
    • Application scenarios
    • Dedicated Line Access Point Address
    • Product advantages
    • Usage restrictions
    • What Is Dedicated Line Access
  • SDK
    • GO SDK
      • Dedicated line
      • Exception handling
      • Initialization
      • Install the SDK Package
      • Overview
      • Version history
    • Java-SDK
      • Dedicated line
      • Exception handling
      • Initialization
      • Install the SDK Package
      • Overview
      • Version history
    • Python SDK
      • Dedicated line
      • Function Release Records
      • Initialization
      • Install the SDK Package
      • Overview
  • Service Level Agreement (SLA)
    • Service Level Agreement (SLA)
  • Typical Practices
    • Connecting On-Premises IDC to Cloud VPC via Multi-Line ECMP (Dynamic Routing)
    • Connecting On-Premises IDC to Cloud VPC via Multi-Line ECMP (Static Routing)
    • Connecting On-Premises IDC to Cloud VPC via Primary and Backup Dedicated Lines (Dynamic Routing)
    • Connecting On-Premises IDC to Cloud VPC via Primary and Backup Dedicated Lines (Static Routing)
    • Interconnecting IDCs and VPCs Across Different Regions via Dedicated Lines
  • Document center
  • arrow
  • ET
  • arrow
  • SDK
  • arrow
  • Java-SDK
  • arrow
  • Exception handling
Table of contents on this page
  • Client exception
  • Server exception
  • SDK logging
  • Default logging
  • Custom logging modules

Exception handling

Updated at:2025-11-11

ET exception prompts are available in the following two ways:

Exception type Description
BceClientException Client exception
BceServerException Server exception

Users can use try to obtain the exception generated by a certain event, e.g.:

Java
1try {
2    etClient.getEtDetail("dcphy-t6ewxjaekkt2");
3 } catch (BceServiceException bce){
4    System.out.println(bce.getMessage());
5 } catch (BceClientException bce){
6    System.out.println(bce.getMessage());
7 }

Client exception

A client exception occurs when the client faces issues during request transmission or file uploads to ET. For example, a ClientException is thrown in cases of network failures or I/O errors.

Server exception

A server exception is generated when ET server-side errors occur. The service returns detailed error messages to assist troubleshooting. For common server exceptions, refer to ET Error Code

SDK logging

The ET Java SDK package uses logback as its default SLF4J implementation. If users do not have their own logging implementation, logback can be used directly. Alternatively, other logging frameworks like log4j can also be employed.

Default logging

To utilize the default logback, include a logback.xml configuration file in the classpath. If this file is missing, the log level defaults to DEBUG.

PHP
1<configuration>
2    <property name="LOG_HOME" value="./log/"/>
3    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
4        <!-- encoders are assigned the type
5             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
6        <encoder>
7            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
8        </encoder>
9    </appender>
10    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
11        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
12            <FileNamePattern>${LOG_HOME}/EtUnitTest.%d{yyyy-MM-dd}.log</FileNamePattern>
13            <MaxHistory>30</MaxHistory>
14        </rollingPolicy>
15        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
16            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
17        </encoder>
18        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
19            <MaxFileSize>10MB</MaxFileSize>
20        </triggeringPolicy>
21    </appender>
22    <root level="info">
23        <appender-ref ref="STDOUT"/>
24        <appender-ref ref="FILE"/>
25    </root>
26</configuration>

Custom logging modules

For projects already equipped with a logging implementation, logback can be excluded via Maven (pom.xml).

XML
1<?xml version="1.0" encoding="utf-8"?>
2<dependency>      
3  <groupId>com.baidubce</groupId>      
4  <artifactId>bce-java-sdk</artifactId>      
5  <version>${bce.sdk.version}</version>      
6  <exclusions>        
7    <exclusion>          
8      <groupId>ch.qos.logback</groupId>          
9      <artifactId>logback-classic</artifactId>        
10    </exclusion>        
11    <exclusion>          
12      <groupId>ch.qos.logback</groupId>          
13      <artifactId>logback-core</artifactId>        
14    </exclusion>        
15    <exclusion>          
16      <groupId>org.slf4j</groupId>          
17      <artifactId>jcl-over-slf4j</artifactId>        
18    </exclusion>      
19  </exclusions>    
20</dependency>

Previous
Dedicated line
Next
Initialization