You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(error): detect accessNotConfigured and guide users to enable APIs (npm#33)
* feat(error): detect accessNotConfigured and guide users to enable APIs
When the Google API returns a 403 with reason accessNotConfigured,
gws now:
- Extracts the GCP Console enable URL from the error message.
- Adds an optional enable_url field to the JSON error output.
- Prints an actionable hint with the enable URL to stderr.
Also adds extract_enable_url() helper with tests, and a Troubleshooting
section to README.
Fixesnpm#31
* fix(error): trim trailing punctuation from accessNotConfigured enable URL
message:"Gmail API has not been used in project 549352339482 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=549352339482 then retry.".to_string(),
// Matches the top-level "reason" field format Google actually returns for this error
1358
+
let json_err = serde_json::json!({
1359
+
"error":{
1360
+
"code":403,
1361
+
"message":"Gmail API has not been used in project 549352339482 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=549352339482 then retry.",
// Some Google APIs put reason in errors[0].reason
1396
+
let json_err = serde_json::json!({
1397
+
"error":{
1398
+
"code":403,
1399
+
"message":"Drive API has not been used in project 12345 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=12345 then retry.",
0 commit comments