()
| 815 | } |
| 816 | |
| 817 | func jsonGoldenErrorOutputExamples() map[string]jsonErrorResponse { |
| 818 | rateLimit := dropboxauth.NewRateLimitError(nil) |
| 819 | rateLimit.RetryAfter = 12 |
| 820 | |
| 821 | examples := map[string]jsonErrorResponse{ |
| 822 | "auth_required": newJSONErrorResponse(jsonErrorExampleCommand("account"), missingAccessTokenError(tokenPersonal)), |
| 823 | "as_member_api_error": newJSONErrorResponse( |
| 824 | jsonErrorExampleCommandWithAsMember("ls", "dbmid:member"), |
| 825 | fmt.Errorf("list folder: %w", files.ListFolderAPIError{APIError: dropbox.APIError{ErrorSummary: "path/not_found/."}}), |
| 826 | ), |
| 827 | "deprecated_warning": newJSONErrorResponse( |
| 828 | jsonDeprecatedErrorExampleCommand("share list link", shareListLinksDeprecatedMessage), |
| 829 | invalidArgumentsErrorWithDetails( |
| 830 | "`share-link list` accepts at most one `path` argument", |
| 831 | mergeJSONErrorDetails(operationErrorDetails("share_link_list"), argumentErrorDetails("path"), pathErrorDetails("/extra")), |
| 832 | ), |
| 833 | ), |
| 834 | "dropbox_api_error": newJSONErrorResponse( |
| 835 | jsonErrorExampleCommand("share-link create"), |
| 836 | withJSONErrorDetails( |
| 837 | fmt.Errorf("share: %w", sharing.CreateSharedLinkWithSettingsAPIError{APIError: dropbox.APIError{ErrorSummary: "shared_link_already_exists/."}}), |
| 838 | operationErrorDetails("share_link_create"), |
| 839 | pathErrorDetails("/Reports/old.pdf"), |
| 840 | ), |
| 841 | ), |
| 842 | "invalid_arguments": newJSONErrorResponse( |
| 843 | jsonErrorExampleCommand("put"), |
| 844 | invalidArgumentsErrorfWithDetails("invalid --if-exists %q (use overwrite, skip, or fail)", flagValueErrorDetails("if-exists", "replace"), "replace"), |
| 845 | ), |
| 846 | "not_found": newJSONErrorResponse( |
| 847 | jsonErrorExampleCommand("get"), |
| 848 | withJSONErrorDetails( |
| 849 | fmt.Errorf("download: %w", files.DownloadAPIError{APIError: dropbox.APIError{ErrorSummary: "path/not_found/."}}), |
| 850 | operationErrorDetails("download"), |
| 851 | pathErrorDetails("/missing.txt"), |
| 852 | ), |
| 853 | ), |
| 854 | "partial_transfer": newJSONErrorResponse( |
| 855 | jsonErrorExampleCommand("get"), |
| 856 | withJSONErrorDetails(partialStdoutError(12), operationErrorDetails("download"), pathErrorDetails("/big.bin")), |
| 857 | ), |
| 858 | "path_conflict": newJSONErrorResponse(jsonErrorExampleCommand("mkdir"), pathConflictErrorWithPath("/file", "path exists and is not a folder: %s", "/file")), |
| 859 | "rate_limited": newJSONErrorResponse( |
| 860 | jsonErrorExampleCommand("put"), |
| 861 | withJSONErrorDetails( |
| 862 | fmt.Errorf("upload: %w", dropboxauth.RateLimitAPIError{APIError: dropbox.APIError{ErrorSummary: "too_many_requests/."}, RateLimitError: rateLimit}), |
| 863 | operationErrorDetails("upload"), |
| 864 | pathErrorDetails("/upload.bin"), |
| 865 | ), |
| 866 | ), |
| 867 | "restore_revision": newJSONErrorResponse( |
| 868 | jsonErrorExampleCommand("restore"), |
| 869 | withJSONErrorDetails( |
| 870 | fmt.Errorf("restore: %w", files.RestoreAPIError{APIError: dropbox.APIError{ErrorSummary: "path/not_found/."}}), |
| 871 | restoreErrorDetails("/Reports/old.pdf", "015f"), |
| 872 | ), |
| 873 | ), |
| 874 | "structured_output_unsupported": newJSONErrorResponse(jsonErrorExampleCommand("login"), output.ErrStructuredOutputUnsupported), |
no test coverage detected