| 438 | } |
| 439 | |
| 440 | func jsonErrorDetails(err error) map[string]any { |
| 441 | details := make(map[string]any) |
| 442 | |
| 443 | collectJSONErrorDetails(err, details) |
| 444 | |
| 445 | if retryAfterSeconds, ok := rateLimitRetryAfterSeconds(err); ok { |
| 446 | details["retry_after_seconds"] = retryAfterSeconds |
| 447 | } |
| 448 | if summary, ok := dropboxAPIErrorSummary(err); ok { |
| 449 | details["api_summary"] = summary |
| 450 | } else if summary, ok := dropboxAPISummaryFromMessage(err.Error()); ok { |
| 451 | details["api_summary"] = summary |
| 452 | } |
| 453 | if endpoint, ok := dropboxAPIEndpointFromMessage(err.Error()); ok { |
| 454 | details["api_endpoint"] = endpoint |
| 455 | } |
| 456 | |
| 457 | if len(details) == 0 { |
| 458 | return nil |
| 459 | } |
| 460 | return details |
| 461 | } |
| 462 | |
| 463 | func jsonErrorDetailsForCommand(cmd *cobra.Command, err error) map[string]any { |
| 464 | details := jsonErrorDetails(err) |