Skip to content

report to users server errors over REST  #1408

@vchudnov-g

Description

@vchudnov-g

Right now, it looks like for at least some server errors, we do not handle or report them to the user and instead (if we're lucky?) encounter an exception later. Case in point: Showcase does not recognize capitalized booleans over rest (the issue in #1407) and returns an error. I can reproduce the error with curl, and the HTTP body is

{"error":{"code":400,"message":"error reading query params: terminal field \"unknownEnum\" of field path \"unknownEnum\" is of type \"bool\" with value string \"False\", which could not be parsed: could not parse \"False\" as a bool","details":null,"Body":"","Header":null,"Errors":null}} 

Using the Python GAPIC, I simply get an exception

TypeError: 'NoneType' object is not iterable 

If I don't catch the exception, the stack trace is (full filepaths redacted):

Traceback (most recent call last): File "HOME/APPDIR/vchudnov_showcase_get_enum.py", line 70, in <module> sample_get_enum() File "HOME/APPDIR/vchudnov_showcase_get_enum.py", line 64, in sample_get_enum response = client.get_enum(request=request) File "HOME/APPDIR/showcase/google/showcase_v1beta1/services/compliance/client.py", line 983, in get_enum response = rpc( File "HOME/.pyenv/versions/3.9.5/lib/python3.9/site-packages/google/api_core/gapic_v1/method.py", line 154, in __call__ return wrapped_func(*args, **kwargs) File "HOME/.pyenv/versions/3.9.5/lib/python3.9/site-packages/google/api_core/grpc_helpers.py", line 50, in error_remapped_callable return callable_(*args, **kwargs) File "HOME/GAPICDIR/google/showcase_v1beta1/services/compliance/transports/rest.py", line 475, in __call__ raise core_exceptions.from_http_response(response) File "HOME/.pyenv/versions/3.9.5/lib/python3.9/site-packages/google/api_core/exceptions.py", line 484, in from_http_response filter( 

Reporting errors correctly should be a blocker for launching REGAPIC.

Metadata

Metadata

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions