MCPcopy Create free account
hub / github.com/openclaw/gogcli / wrapSearchConsoleError

Function wrapSearchConsoleError

internal/cmd/searchconsole.go:491–509  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

489}
490
491func wrapSearchConsoleError(err error) error {
492 var apiErr *gapi.Error
493 if !errors.As(err, &apiErr) {
494 return err
495 }
496 if apiErr.Code != 403 {
497 return err
498 }
499
500 message := strings.ToLower(apiErr.Message)
501 switch {
502 case strings.Contains(message, "accessnotconfigured"), strings.Contains(message, "api has not been used"):
503 return fmt.Errorf("search console API is not enabled for this OAuth project. Enable it at https://console.cloud.google.com/apis/api/searchconsole.googleapis.com")
504 case strings.Contains(message, "insufficientpermissions"), strings.Contains(message, "insufficient permission"):
505 return fmt.Errorf("insufficient permissions for Search Console API. Re-authorize with: gog auth add <email> --services searchconsole")
506 default:
507 return err
508 }
509}

Callers 7

RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85
RunMethod · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected