MCPcopy Create free account
hub / github.com/dropbox/dbxcli / jsonGoldenErrorOutputExamples

Function jsonGoldenErrorOutputExamples

cmd/json_contract_test.go:817–881  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

815}
816
817func 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),

Calls 15

newJSONErrorResponseFunction · 0.85
jsonErrorExampleCommandFunction · 0.85
missingAccessTokenErrorFunction · 0.85
mergeJSONErrorDetailsFunction · 0.85
operationErrorDetailsFunction · 0.85
argumentErrorDetailsFunction · 0.85
pathErrorDetailsFunction · 0.85
withJSONErrorDetailsFunction · 0.85

Tested by

no test coverage detected