Exception handling
Updated at:2025-11-03
BOS exception prompts are available in the following four ways:
| Exception type | Description |
|---|---|
| BceHttpException | Client exception |
| BceServerException | Server exception |
| BceHttpException | net::http related exceptions |
Users can use rescue to obtain the exception generated by a certain event:
Ruby
1begin
2 client.get_object_meta_data(bucket_name, object_name)
3rescue Exception => e
4 puts "Catch a http exception" if e.is_a?(BceHttpException)
5 puts "Catch a client exception" if e.is_a?(BceClientException)
6 puts "Catch a server exception" if e.is_a?(BceServerException)
7end
Client exception
A client exception occurs when the client encounters issues while sending requests or transferring data to BOS.
Server exception
A server exception is generated when BOS server-side errors occur. The service returns detailed error messages to assist troubleshooting. For common server exceptions, refer to [BOS Error Message Format](BOS/API Reference/Error code.md)
