Errors

The Files.com Ruby SDK will return errors by raising exceptions. There are many exception classes defined in the Files SDK that correspond to specific errors.

The raised exceptions come from two categories:

  1. SDK Exceptions - errors that originate within the SDK
  2. API Exceptions - errors that occur due to the response from the Files.com API. These errors are grouped into common error types.

There are several types of exceptions within each category. Exception classes indicate different types of errors and are named in a fashion that describe the general premise of the originating error. More details can be found in the message attribute of the capture exception object.

Use standard Ruby exception handling to detect and deal with errors. It is generally recommended to rescue for specific errors first, then rescue for general Files::Error as a catch-all.

Example Error Handling

begin
  session = Files::Session.create(username: "USERNAME", password: "BADPASSWORD")
rescue Files::NotAuthenticatedError => e
  puts "Authentication Error Occurred (#{e.class.to_s}): " + e.message
rescue Files::Error => e
  puts "Unknown Error Occurred (#{e.class.to_s}): " + e.message
end

Error Types

SDK Errors

SDK errors are general errors that occur within the SDK code. Each exception class inherits from a standard Error base class.

Example SDK Exception Class Inheritance Structure

Files::APIConnectionError -> Files::Error -> StandardError

SDK Exception Classes

Error Class NameDescription
APIConnectionErrorThe Files.com API cannot be reached
AuthenticationErrorNot enough authentication information has been provided
InvalidParameterErrorA passed in parameter is invalid
MissingParameterErrorA method parameter is missing
NotImplementedErrorThe called method has not be implemented by the SDK

API Errors

API errors are errors returned by the Files.com API. Each exception class inherits from an error group base class. The error group base class indicates a particular type of error.

Example API Exception Class Inheritance Structure

Files::FolderAdminPermissionRequiredError -> Files::NotAuthorizedError -> Files::Error -> StandardError

API Exception Classes

Error Class NameError Group
AgentUpgradeRequiredErrorBadRequestError
AttachmentTooLargeErrorBadRequestError
CannotDownloadDirectoryErrorBadRequestError
CantMoveWithMultipleLocationsErrorBadRequestError
DatetimeParseErrorBadRequestError
DestinationSameErrorBadRequestError
DestinationSiteMismatchErrorBadRequestError
DoesNotSupportSortingErrorBadRequestError
FolderMustNotBeAFileErrorBadRequestError
FoldersNotAllowedErrorBadRequestError
InternalGeneralErrorErrorBadRequestError
InvalidBodyErrorBadRequestError
InvalidCursorErrorBadRequestError
InvalidCursorTypeForSortErrorBadRequestError
InvalidEtagsErrorBadRequestError
InvalidFilterAliasCombinationErrorBadRequestError
InvalidFilterFieldErrorBadRequestError
InvalidFilterParamErrorBadRequestError
InvalidFilterParamFormatErrorBadRequestError
InvalidFilterParamValueErrorBadRequestError
InvalidInputEncodingErrorBadRequestError
InvalidInterfaceErrorBadRequestError
InvalidOauthProviderErrorBadRequestError
InvalidPathErrorBadRequestError
InvalidReturnToUrlErrorBadRequestError
InvalidSearchQueryErrorBadRequestError
InvalidSortFieldErrorBadRequestError
InvalidSortFilterCombinationErrorBadRequestError
InvalidUploadOffsetErrorBadRequestError
InvalidUploadPartGapErrorBadRequestError
InvalidUploadPartSizeErrorBadRequestError
InvalidWorkspaceIdHeaderErrorBadRequestError
MethodNotAllowedErrorBadRequestError
MultipleSortParamsNotAllowedErrorBadRequestError
NoValidInputParamsErrorBadRequestError
OffsetUploadNotAllowedWithMalwareScanningErrorBadRequestError
PartNumberTooLargeErrorBadRequestError
PathCannotHaveTrailingWhitespaceErrorBadRequestError
ReauthenticationNeededFieldsErrorBadRequestError
RequestBodyTooLargeErrorBadRequestError
RequestParamsContainInvalidCharacterErrorBadRequestError
RequestParamsInvalidErrorBadRequestError
RequestParamsRequiredErrorBadRequestError
SearchAllOnChildPathErrorBadRequestError
UnrecognizedSortIndexErrorBadRequestError
UnsupportedCurrencyErrorBadRequestError
UnsupportedHttpResponseFormatErrorBadRequestError
UnsupportedMediaTypeErrorBadRequestError
UserIdInvalidErrorBadRequestError
UserIdOnUserEndpointErrorBadRequestError
UserRequiredErrorBadRequestError
AdditionalAuthenticationRequiredErrorNotAuthenticatedError
ApiKeySessionsNotSupportedErrorNotAuthenticatedError
AuthenticationRequiredErrorNotAuthenticatedError
BundleRegistrationCodeFailedErrorNotAuthenticatedError
FilesAgentTokenFailedErrorNotAuthenticatedError
InboxRegistrationCodeFailedErrorNotAuthenticatedError
InvalidCredentialsErrorNotAuthenticatedError
InvalidOauthErrorNotAuthenticatedError
InvalidOrExpiredCodeErrorNotAuthenticatedError
InvalidSessionErrorNotAuthenticatedError
InvalidUsernameOrPasswordErrorNotAuthenticatedError
LockedOutErrorNotAuthenticatedError
LockoutRegionMismatchErrorNotAuthenticatedError
OneTimePasswordIncorrectErrorNotAuthenticatedError
TwoFactorAuthenticationErrorErrorNotAuthenticatedError
TwoFactorAuthenticationSetupExpiredErrorNotAuthenticatedError
ApiKeyIsDisabledErrorNotAuthorizedError
ApiKeyIsPathRestrictedErrorNotAuthorizedError
ApiKeyOnlyForDesktopAppErrorNotAuthorizedError
ApiKeyOnlyForMobileAppErrorNotAuthorizedError
ApiKeyOnlyForOfficeIntegrationErrorNotAuthorizedError
BillingInformationHiddenErrorNotAuthorizedError
BillingPermissionRequiredErrorNotAuthorizedError
BundleMaximumUsesReachedErrorNotAuthorizedError
BundlePermissionRequiredErrorNotAuthorizedError
CannotLoginWhileUsingKeyErrorNotAuthorizedError
CantActForOtherUserErrorNotAuthorizedError
ContactAdminForPasswordChangeHelpErrorNotAuthorizedError
FilesAgentFailedAuthorizationErrorNotAuthorizedError
FolderAdminOrBillingPermissionRequiredErrorNotAuthorizedError
FolderAdminPermissionRequiredErrorNotAuthorizedError
FullPermissionRequiredErrorNotAuthorizedError
HistoryPermissionRequiredErrorNotAuthorizedError
InAppAiAssistantUnavailableErrorNotAuthorizedError
InsufficientPermissionForParamsErrorNotAuthorizedError
InsufficientPermissionForSiteErrorNotAuthorizedError
MoverAccessDeniedErrorNotAuthorizedError
MoverPackageRequiredErrorNotAuthorizedError
MustAuthenticateWithApiKeyErrorNotAuthorizedError
NeedAdminPermissionForInboxErrorNotAuthorizedError
NonAdminsMustQueryByFolderOrPathErrorNotAuthorizedError
NotAllowedToCreateBundleErrorNotAuthorizedError
NotEnqueuableSyncErrorNotAuthorizedError
PasswordChangeNotRequiredErrorNotAuthorizedError
PasswordChangeRequiredErrorNotAuthorizedError
PaymentMethodErrorErrorNotAuthorizedError
PreviewOnlyPermissionCannotDownloadErrorNotAuthorizedError
ReadOnlySessionErrorNotAuthorizedError
ReadPermissionRequiredErrorNotAuthorizedError
ReauthenticationFailedErrorNotAuthorizedError
ReauthenticationFailedFinalErrorNotAuthorizedError
ReauthenticationNeededActionErrorNotAuthorizedError
RecaptchaFailedErrorNotAuthorizedError
RemoteDesktopDebugLoggingDisabledErrorNotAuthorizedError
RootFolderBehaviorSiteAdminRequiredErrorNotAuthorizedError
RootFolderBehaviorSkipSiteAdminRequiredErrorNotAuthorizedError
SelfManagedRequiredErrorNotAuthorizedError
SiteAdminOrPartnerAdminPermissionRequiredErrorNotAuthorizedError
SiteAdminOrWorkspaceAdminOrFolderAdminPermissionRequiredErrorNotAuthorizedError
SiteAdminOrWorkspaceAdminOrPartnerAdminOrFolderAdminPermissionRequiredErrorNotAuthorizedError
SiteAdminOrWorkspaceAdminOrPartnerAdminPermissionRequiredErrorNotAuthorizedError
SiteAdminOrWorkspaceAdminPermissionRequiredErrorNotAuthorizedError
SiteAdminRequiredErrorNotAuthorizedError
SiteFilesAreImmutableErrorNotAuthorizedError
TwoFactorAuthenticationRequiredErrorNotAuthorizedError
UserIdWithoutSiteAdminErrorNotAuthorizedError
WriteAndBundlePermissionRequiredErrorNotAuthorizedError
WritePermissionRequiredErrorNotAuthorizedError
ApiKeyNotFoundErrorNotFoundError
BundlePathNotFoundErrorNotFoundError
BundleRegistrationNotFoundErrorNotFoundError
CodeNotFoundErrorNotFoundError
FileNotFoundErrorNotFoundError
FileUploadNotFoundErrorNotFoundError
GroupNotFoundErrorNotFoundError
InboxNotFoundErrorNotFoundError
NestedNotFoundErrorNotFoundError
PlanNotFoundErrorNotFoundError
SiteNotFoundErrorNotFoundError
UserNotFoundErrorNotFoundError
AgentPushUpdateBlockedErrorProcessingFailureError
AgentUnavailableErrorProcessingFailureError
AiTaskCannotBeRunManuallyErrorProcessingFailureError
AlreadyCompletedErrorProcessingFailureError
AutomationCannotBeRunManuallyErrorProcessingFailureError
BehaviorNotAllowedOnRemoteServerErrorProcessingFailureError
BufferedUploadDisabledForThisDestinationErrorProcessingFailureError
BundleOnlyAllowsPreviewsErrorProcessingFailureError
BundleOperationRequiresSubfolderErrorProcessingFailureError
ConfigurationLockedPathErrorProcessingFailureError
CouldNotCreateParentErrorProcessingFailureError
DestinationExistsErrorProcessingFailureError
DestinationFolderLimitedErrorProcessingFailureError
DestinationParentConflictErrorProcessingFailureError
DestinationParentDoesNotExistErrorProcessingFailureError
ExceededRuntimeLimitErrorProcessingFailureError
ExpectationAlreadyHasOpenWindowErrorProcessingFailureError
ExpectationNotManualTriggerErrorProcessingFailureError
ExpiredPrivateKeyErrorProcessingFailureError
ExpiredPublicKeyErrorProcessingFailureError
ExportFailureErrorProcessingFailureError
ExportNotReadyErrorProcessingFailureError
FailedToChangePasswordErrorProcessingFailureError
FileLockedErrorProcessingFailureError
FileNotUploadedErrorProcessingFailureError
FilePendingProcessingErrorProcessingFailureError
FileProcessingErrorErrorProcessingFailureError
FileTooBigToDecryptErrorProcessingFailureError
FileTooBigToEncryptErrorProcessingFailureError
FileUploadedToWrongRegionErrorProcessingFailureError
FilenameTooLongErrorProcessingFailureError
FolderLockedErrorProcessingFailureError
FolderNotEmptyErrorProcessingFailureError
HistoryUnavailableErrorProcessingFailureError
InvalidBundleCodeErrorProcessingFailureError
InvalidFileTypeErrorProcessingFailureError
InvalidFilenameErrorProcessingFailureError
InvalidPriorityColorErrorProcessingFailureError
InvalidRangeErrorProcessingFailureError
InvalidSiteErrorProcessingFailureError
InvalidZipFileErrorProcessingFailureError
MetadataNotSupportedOnRemotesErrorProcessingFailureError
ModelSaveErrorErrorProcessingFailureError
MultipleProcessingErrorsErrorProcessingFailureError
PathTooLongErrorProcessingFailureError
RecipientAlreadySharedErrorProcessingFailureError
RemoteServerErrorErrorProcessingFailureError
ResourceBelongsToParentSiteErrorProcessingFailureError
ResourceLockedErrorProcessingFailureError
SubfolderLockedErrorProcessingFailureError
SyncInProgressErrorProcessingFailureError
TwoFactorAuthenticationCodeAlreadySentErrorProcessingFailureError
TwoFactorAuthenticationCountryBlacklistedErrorProcessingFailureError
TwoFactorAuthenticationGeneralErrorErrorProcessingFailureError
TwoFactorAuthenticationMethodUnsupportedErrorErrorProcessingFailureError
TwoFactorAuthenticationUnsubscribedRecipientErrorProcessingFailureError
UpdatesNotAllowedForRemotesErrorProcessingFailureError
DuplicateShareRecipientErrorRateLimitedError
ReauthenticationRateLimitedErrorRateLimitedError
TooManyConcurrentLoginsErrorRateLimitedError
TooManyConcurrentRequestsErrorRateLimitedError
TooManyLoginAttemptsErrorRateLimitedError
TooManyRequestsErrorRateLimitedError
TooManySharesErrorRateLimitedError
AutomationsUnavailableErrorServiceUnavailableError
MigrationInProgressErrorServiceUnavailableError
SiteDisabledErrorServiceUnavailableError
UploadsUnavailableErrorServiceUnavailableError
AccountAlreadyExistsErrorSiteConfigurationError
AccountOverdueErrorSiteConfigurationError
NoAccountForSiteErrorSiteConfigurationError
SiteWasRemovedErrorSiteConfigurationError
TrialExpiredErrorSiteConfigurationError
TrialLockedErrorSiteConfigurationError
UserRequestsEnabledRequiredErrorSiteConfigurationError