-
-
Notifications
You must be signed in to change notification settings - Fork 35.9k
Catch PermissionDenied(Route API disabled) in google_travel_time #145722
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
Catch PermissionDenied(Route API disabled) in google_travel_time #145722
Conversation
73f4faf to
38270a1
Compare
| } | ||
| }, | ||
| "error": { | ||
| "permission_denied": "The Routes API is not enabled for this API key.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add more context? Or do we have more context inthe descriptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't enough space in the UI and the docs have everyhing: https://www.home-assistant.io/integrations/google_travel_time/#setup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But let's then at least explain a bit more and/or redirect the user to the docs. In my experience a lot of people mess up with google API access, so the clearer, the better (even though it might be a lot of text)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean a link in the error to the HomeAssistant docs in addition to the Button in the config flow UI? Or a phrase like "Please check the HA docs for this integration?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just something that would explain to the user why their key failed and what they need to do. I don't expect a lot of people to understand that they're still doing something wrong so I think we can be more pointing to what they should be doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed it
| "issues": { | ||
| "routes_api_disabled": { | ||
| "title": "The Routes API must be enabled", | ||
| "description": "Your Google Travel Time integration `{entry_title}` uses an API key which does not have the Routes API enabled.\n\n Please follow the instructions to [enable the API for your project](https://cloud.google.com/endpoints/docs/openapi/enable-api) and make sure your [API key restrictions](https://cloud.google.com/docs/authentication/api-keys#adding-api-restrictions) allow access to the Routes API.\n\n After enabling the API this issue will be resolved automatically." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
links should be added as placeholders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
38270a1 to
0eafa37
Compare
0eafa37 to
0a31455
Compare
…5722) Catch PermissionDenied(Route API disabled)
Proposed change
Catch PermissionDenied exception returned when the new Routes API is not enabled.
Display a dedicated error message in the ConfigFlow during setup.
Create an issue for already existing integrations.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: