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)
| 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. |
| 261 | func 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 | |
| 275 | func buildPermissionError(p errs.Problem, resp map[string]any, cc ClassifyContext) *errs.PermissionError { |
| 276 | missing := extractMissingScopes(resp) |