MCPcopy
hub / github.com/larksuite/cli / APIHint

Function APIHint

internal/errclass/classify.go:261–273  ·  view source on GitHub ↗

APIHint returns the canonical per-subtype recovery hint for a typed APIError emitted via BuildAPIError, for API subtypes whose recovery is context-free. Context-specific guidance (e.g. a command's flags, an API's own quota) is layered on by the caller after BuildAPIError returns and overrides this.

(subtype errs.Subtype)

Source from the content-addressed store, hash-verified

259// Context-specific guidance (e.g. a command's flags, an API's own quota) is
260// layered on by the caller after BuildAPIError returns and overrides this.
261func APIHint(subtype errs.Subtype) string {
262 switch subtype {
263 case errs.SubtypeConflict:
264 return "retry later and avoid concurrent duplicate requests on the same resource"
265 case errs.SubtypeCrossTenant:
266 return "operate on source and target within the same tenant and region/unit"
267 case errs.SubtypeCrossBrand:
268 return "operate on source and target within the same brand environment"
269 case errs.SubtypeQuotaExceeded:
270 return "reduce the request volume or free quota, then retry after the relevant quota resets"
271 }
272 return ""
273}
274
275func buildPermissionError(p errs.Problem, resp map[string]any, cc ClassifyContext) *errs.PermissionError {
276 missing := extractMissingScopes(resp)

Callers 1

BuildAPIErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected