擅长:python、mysql、java
<p>谷歌云现在提供异常处理程序:</p>
<pre><code>from google.api_core.exceptions import AlreadyExists, NotFound
try:
...
except AlreadyExists:
...
except NotFound:
...
</code></pre>
<p>在捕捉错误的细节时,这应该更准确。</p>
<p>请参考此源代码以查找其他要利用的异常:<a href="http://google-cloud-python.readthedocs.io/en/latest/_modules/google/api_core/exceptions.html" rel="noreferrer">http://google-cloud-python.readthedocs.io/en/latest/_modules/google/api_core/exceptions.html</a></p>