简体   繁体   中英

How to handle possible exceptions that might occur when using GCP API

I am working on a python script to monitor resources in GCP. I used the GCP Python API's and completed my script but I can't find how to add exception handling to it. I did the same for AWS and I found the exceptions that occur in each method I used in AWS through the documentation since it provided all the possible exceptions that can occur in each API Method. Is there a similar documentation I can refer to when it comes to GCP? I can't find similar explanation in GCP documentation. For example in aws documentation: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/iam.html#IAM.Client.list_users

list users method exceptions

I want similar reference in GCP like this. Please help.

Reference link for the exceptions raised by Google API core & clients:
https://googleapis.dev/python/google-api-core/latest/exceptions.html

Core Library for Google Client Libraries:
Search this repository for sample code on exceptions.
https://github.com/googleapis/python-api-core

Reference link for all api's and their associated python client libraries:
https://cloud.google.com/python/docs/reference
(For each service there is a link provided to the python client library. Clink on the link and search the repository for sample code on exceptions)

Refer to the link below for more information on client libraries:
https://cloud.google.com/apis/docs/cloud-client-libraries

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM