Skip to content

Transcoding Error Improvements #441

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

Closed
parthea opened this issue Sep 13, 2022 · 0 comments · Fixed by #442
Closed

Transcoding Error Improvements #441

parthea opened this issue Sep 13, 2022 · 0 comments · Fixed by #442
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@parthea
Copy link
Collaborator

parthea commented Sep 13, 2022

raise ValueError(
"Request {} does not match any URL path template in available HttpRule's {}".format(
request_kwargs, [opt["uri"] for opt in http_options]
)

The transcoding error above should be improved to provide more helpful information when there is a transcoding issue. For example, given the code below which is missing the instance_group parameter, the error message should say something along the lines of missing required parameter instance_group instead of the cryptic error Request {} does not match any URL path template in available HttpRule's ['/compute/v1/projects/{project}/zones/{zone}/instanceGroups/{instance_group}/listInstances']. In addition, it's not desirable to echo the parameters in the error message.

from google.cloud import compute_v1

project = "project-XXX"
zone = "us-central1-a"

instance_groups_list_instances_request_resource = compute_v1.InstanceGroupsListInstancesRequest()
instance_groups_list_instances_request_resource.instance_state = "RUNNING"
instance_groups_client = compute_v1.InstanceGroupsClient()

instance_groups_list = instance_groups_client.list_instances(project=project, zone=zone,  instance_groups_list_instances_request_resource=instance_groups_list_instances_request_resource)

for instance in instance_groups_list:
    print(instance.name, instance.labels)
@parthea parthea added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Sep 13, 2022
vam-google added a commit to vam-google/python-api-core that referenced this issue Sep 13, 2022
This fixes googleapis#441 and googleapis#440. Also, with this change we stop outputting the whole request message in transcodding erro message to prevent leaking any confidential information from a request message in a form of an error in a log message.
parthea pushed a commit that referenced this issue Sep 14, 2022
* fix: Improve transcodding error message

This fixes #441 and #440. Also, with this change we stop outputting the whole request message in transcodding erro message to prevent leaking any confidential information from a request message in a form of an error in a log message.

* reformat code with black
parthea pushed a commit that referenced this issue Sep 14, 2022
* fix: Improve transcodding error message

This fixes #441 and #440. Also, with this change we stop outputting the whole request message in transcodding erro message to prevent leaking any confidential information from a request message in a form of an error in a log message.

* reformat code with black
vam-google added a commit that referenced this issue Sep 14, 2022
* fix: Improve transcodding error message

This fixes #441 and #440. Also, with this change we stop outputting the whole request message in transcodding erro message to prevent leaking any confidential information from a request message in a form of an error in a log message.

* reformat code with black

Co-authored-by: Vadym Matsishevskyi <25311427+vam-google@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant