-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move '_catch_remap_gax_error' to 'core.exceptions'. #3444
Move '_catch_remap_gax_error' to 'core.exceptions'. #3444
Conversation
core/google/cloud/exceptions.py
Outdated
_Rendezvous = None | ||
else: | ||
_HAVE_GRPC = True |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
core/google/cloud/exceptions.py
Outdated
@@ -250,3 +259,44 @@ def _walk_subclasses(klass): | |||
code = getattr(_eklass, 'code', None) | |||
if code is not None: | |||
_HTTP_CODE_TO_EXCEPTION[code] = _eklass | |||
|
|||
_GRPC_ERROR_MAPPING = { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
core/google/cloud/exceptions.py
Outdated
|
||
|
||
@contextlib.contextmanager | ||
def _catch_remap_gax_error(): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -56,6 +56,7 @@ | |||
'protobuf >= 3.0.0', | |||
'google-auth >= 0.4.0, < 2.0.0dev', | |||
'google-auth-httplib2', | |||
'google-gax>=0.15.7, <0.16dev', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
core/tests/unit/test_exceptions.py
Outdated
@@ -14,6 +14,8 @@ | |||
|
|||
import unittest | |||
|
|||
from google.cloud.exceptions import _HAVE_GRPC |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
We depend on explicitly in core.
'core' now depends on it explicitly.
@lukesneeringer Are you good with the dependency changes? |
Note that this change will require releasing a new version of |
👍 on the release (I think @lukesneeringer is somewhat anti to the idea of |
@dhermes was there another new
|
#3436 was what I was talking about. Looks like we've hit 24 hours, so LGTM? |
@dhermes this PR wasn't in the penalty box :). I'm fine to merge today unless @lukesneeringer has issues with us pushing a new |
Is the core change backwards-compatible (from an API surface standpoint), or is it something where every single subpackage has to be updated? I do not mind churn on core; back-incompat churn where everything has to move along with it makes me nervous. |
@lukesneeringer the API surface changes are backward-compatible (the add a new, non-API helper function), but the dependency changes are maybe problematic ( |
That is a smidge concerning. It would mean that APIs based on HTTP only would now require the installation of (but not use of) GRPC. Would it be possible to only do the mapping if GAX was present, but not require it? (e.g. |
We already have this for "dual mode" APIs: even on "classic" GAE they install grpc / gax.
We can indeed revert to doing that: this PR actually backs that stuff out. |
I vote with Luke - can we do this in a way that doesn't require gRPC in core (for now)? I would really like to have this so I can move #3617 forward. |
Redoing this on a new branch (recent |
Reworked in #3707. |
Toward #3175.
This is the first step toward applying a more uniform mapping of GAX error codes to our exception hierarchy. For a narrower, pubsub-only fix for #3175, see #3443.