Errors

The Files.com PHP 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 exception object message using the php getMessage() method call.

Use standard PHP exception handling to detect and deal with errors. It is generally recommended to catch specific errors first, then catch the general Files\FilesException exception as a catch-all.

Example Error Handling

try {
  $session = Files\Model\Session::create(['username' => 'USERNAME', 'password' => 'BADPASSWORD']);
} catch (\Files\NotAuthenticated\InvalidUsernameOrPasswordException $e) {
  echo 'Authentication Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
} catch (\Files\FilesException $e) {
  echo 'Unknown Error Occurred (' . get_class($e) . '): ', $e->getMessage(), "\n";
}

Error Types

SDK Errors

SDK errors are general errors that occur within the SDK code. These errors generate exceptions. Each of these exception classes inherit from a standard Exception base class.

Example SDK Exception Class Inheritance Structure

Files\Exception\ApiConnectException ->
Files\Exception\FilesException ->
Exception

SDK Exception Classes

Exception Class NameDescription
ApiBadResponseExceptionA bad formed response came back from the API
ApiConnectExceptionThe Files.com API cannot be reached
ApiRequestExceptionThere was an issue with the API request itself
ApiServerExceptionThe API service responded with a bad response (ie, 5xx)
ApiTooManyRedirectsExceptionThe API service redirected too many times
ConfigurationExceptionInvalid SDK configuration parameters
EmptyPropertyExceptionAn required property was empty
InvalidParameterExceptionA passed in parameter is invalid
MissingParameterExceptionA method parameter is missing
NotImplementedExceptionThe 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\Exception\NotAuthorizedException\FolderAdminPermissionRequiredException ->
Files\Exception\NotAuthorizedException ->
Files\Exception\ApiException ->
Files\Exception\FilesException ->
Exception

API Exception Classes

Exception Class NameError Group
AgentUpgradeRequiredExceptionBadRequestException
AttachmentTooLargeExceptionBadRequestException
CannotDownloadDirectoryExceptionBadRequestException
CantMoveWithMultipleLocationsExceptionBadRequestException
DatetimeParseExceptionBadRequestException
DestinationSameExceptionBadRequestException
DestinationSiteMismatchExceptionBadRequestException
DoesNotSupportSortingExceptionBadRequestException
FolderMustNotBeAFileExceptionBadRequestException
FoldersNotAllowedExceptionBadRequestException
InternalGeneralErrorExceptionBadRequestException
InvalidBodyExceptionBadRequestException
InvalidCursorExceptionBadRequestException
InvalidCursorTypeForSortExceptionBadRequestException
InvalidEtagsExceptionBadRequestException
InvalidFilterAliasCombinationExceptionBadRequestException
InvalidFilterFieldExceptionBadRequestException
InvalidFilterParamExceptionBadRequestException
InvalidFilterParamFormatExceptionBadRequestException
InvalidFilterParamValueExceptionBadRequestException
InvalidInputEncodingExceptionBadRequestException
InvalidInterfaceExceptionBadRequestException
InvalidOauthProviderExceptionBadRequestException
InvalidPathExceptionBadRequestException
InvalidReturnToUrlExceptionBadRequestException
InvalidSearchQueryExceptionBadRequestException
InvalidSortFieldExceptionBadRequestException
InvalidSortFilterCombinationExceptionBadRequestException
InvalidUploadOffsetExceptionBadRequestException
InvalidUploadPartGapExceptionBadRequestException
InvalidUploadPartSizeExceptionBadRequestException
InvalidWorkspaceIdHeaderExceptionBadRequestException
MethodNotAllowedExceptionBadRequestException
MultipleSortParamsNotAllowedExceptionBadRequestException
NoValidInputParamsExceptionBadRequestException
OffsetUploadNotAllowedWithMalwareScanningExceptionBadRequestException
PartNumberTooLargeExceptionBadRequestException
PathCannotHaveTrailingWhitespaceExceptionBadRequestException
ReauthenticationNeededFieldsExceptionBadRequestException
RequestBodyTooLargeExceptionBadRequestException
RequestParamsContainInvalidCharacterExceptionBadRequestException
RequestParamsInvalidExceptionBadRequestException
RequestParamsRequiredExceptionBadRequestException
SearchAllOnChildPathExceptionBadRequestException
UnrecognizedSortIndexExceptionBadRequestException
UnsupportedCurrencyExceptionBadRequestException
UnsupportedHttpResponseFormatExceptionBadRequestException
UnsupportedMediaTypeExceptionBadRequestException
UserIdInvalidExceptionBadRequestException
UserIdOnUserEndpointExceptionBadRequestException
UserRequiredExceptionBadRequestException
AdditionalAuthenticationRequiredExceptionNotAuthenticatedException
ApiKeySessionsNotSupportedExceptionNotAuthenticatedException
AuthenticationRequiredExceptionNotAuthenticatedException
BundleRegistrationCodeFailedExceptionNotAuthenticatedException
FilesAgentTokenFailedExceptionNotAuthenticatedException
InboxRegistrationCodeFailedExceptionNotAuthenticatedException
InvalidCredentialsExceptionNotAuthenticatedException
InvalidOauthExceptionNotAuthenticatedException
InvalidOrExpiredCodeExceptionNotAuthenticatedException
InvalidSessionExceptionNotAuthenticatedException
InvalidUsernameOrPasswordExceptionNotAuthenticatedException
LockedOutExceptionNotAuthenticatedException
LockoutRegionMismatchExceptionNotAuthenticatedException
OneTimePasswordIncorrectExceptionNotAuthenticatedException
TwoFactorAuthenticationErrorExceptionNotAuthenticatedException
TwoFactorAuthenticationSetupExpiredExceptionNotAuthenticatedException
ApiKeyIsDisabledExceptionNotAuthorizedException
ApiKeyIsPathRestrictedExceptionNotAuthorizedException
ApiKeyOnlyForDesktopAppExceptionNotAuthorizedException
ApiKeyOnlyForMobileAppExceptionNotAuthorizedException
ApiKeyOnlyForOfficeIntegrationExceptionNotAuthorizedException
BillingInformationHiddenExceptionNotAuthorizedException
BillingPermissionRequiredExceptionNotAuthorizedException
BundleMaximumUsesReachedExceptionNotAuthorizedException
BundlePermissionRequiredExceptionNotAuthorizedException
CannotLoginWhileUsingKeyExceptionNotAuthorizedException
CantActForOtherUserExceptionNotAuthorizedException
ContactAdminForPasswordChangeHelpExceptionNotAuthorizedException
FilesAgentFailedAuthorizationExceptionNotAuthorizedException
FolderAdminOrBillingPermissionRequiredExceptionNotAuthorizedException
FolderAdminPermissionRequiredExceptionNotAuthorizedException
FullPermissionRequiredExceptionNotAuthorizedException
HistoryPermissionRequiredExceptionNotAuthorizedException
InAppAiAssistantUnavailableExceptionNotAuthorizedException
InsufficientPermissionForParamsExceptionNotAuthorizedException
InsufficientPermissionForSiteExceptionNotAuthorizedException
MoverAccessDeniedExceptionNotAuthorizedException
MoverPackageRequiredExceptionNotAuthorizedException
MustAuthenticateWithApiKeyExceptionNotAuthorizedException
NeedAdminPermissionForInboxExceptionNotAuthorizedException
NonAdminsMustQueryByFolderOrPathExceptionNotAuthorizedException
NotAllowedToCreateBundleExceptionNotAuthorizedException
NotEnqueuableSyncExceptionNotAuthorizedException
PasswordChangeNotRequiredExceptionNotAuthorizedException
PasswordChangeRequiredExceptionNotAuthorizedException
PaymentMethodErrorExceptionNotAuthorizedException
PreviewOnlyPermissionCannotDownloadExceptionNotAuthorizedException
ReadOnlySessionExceptionNotAuthorizedException
ReadPermissionRequiredExceptionNotAuthorizedException
ReauthenticationFailedExceptionNotAuthorizedException
ReauthenticationFailedFinalExceptionNotAuthorizedException
ReauthenticationNeededActionExceptionNotAuthorizedException
RecaptchaFailedExceptionNotAuthorizedException
RemoteDesktopDebugLoggingDisabledExceptionNotAuthorizedException
RootFolderBehaviorSiteAdminRequiredExceptionNotAuthorizedException
RootFolderBehaviorSkipSiteAdminRequiredExceptionNotAuthorizedException
SelfManagedRequiredExceptionNotAuthorizedException
SiteAdminOrPartnerAdminPermissionRequiredExceptionNotAuthorizedException
SiteAdminOrWorkspaceAdminOrFolderAdminPermissionRequiredExceptionNotAuthorizedException
SiteAdminOrWorkspaceAdminOrPartnerAdminOrFolderAdminPermissionRequiredExceptionNotAuthorizedException
SiteAdminOrWorkspaceAdminOrPartnerAdminPermissionRequiredExceptionNotAuthorizedException
SiteAdminOrWorkspaceAdminPermissionRequiredExceptionNotAuthorizedException
SiteAdminRequiredExceptionNotAuthorizedException
SiteFilesAreImmutableExceptionNotAuthorizedException
TwoFactorAuthenticationRequiredExceptionNotAuthorizedException
UserIdWithoutSiteAdminExceptionNotAuthorizedException
WriteAndBundlePermissionRequiredExceptionNotAuthorizedException
WritePermissionRequiredExceptionNotAuthorizedException
ApiKeyNotFoundExceptionNotFoundException
BundlePathNotFoundExceptionNotFoundException
BundleRegistrationNotFoundExceptionNotFoundException
CodeNotFoundExceptionNotFoundException
FileNotFoundExceptionNotFoundException
FileUploadNotFoundExceptionNotFoundException
GroupNotFoundExceptionNotFoundException
InboxNotFoundExceptionNotFoundException
NestedNotFoundExceptionNotFoundException
PlanNotFoundExceptionNotFoundException
SiteNotFoundExceptionNotFoundException
UserNotFoundExceptionNotFoundException
AgentPushUpdateBlockedExceptionProcessingFailureException
AgentUnavailableExceptionProcessingFailureException
AiTaskCannotBeRunManuallyExceptionProcessingFailureException
AlreadyCompletedExceptionProcessingFailureException
AutomationCannotBeRunManuallyExceptionProcessingFailureException
BehaviorNotAllowedOnRemoteServerExceptionProcessingFailureException
BufferedUploadDisabledForThisDestinationExceptionProcessingFailureException
BundleOnlyAllowsPreviewsExceptionProcessingFailureException
BundleOperationRequiresSubfolderExceptionProcessingFailureException
ConfigurationLockedPathExceptionProcessingFailureException
CouldNotCreateParentExceptionProcessingFailureException
DestinationExistsExceptionProcessingFailureException
DestinationFolderLimitedExceptionProcessingFailureException
DestinationParentConflictExceptionProcessingFailureException
DestinationParentDoesNotExistExceptionProcessingFailureException
ExceededRuntimeLimitExceptionProcessingFailureException
ExpectationAlreadyHasOpenWindowExceptionProcessingFailureException
ExpectationNotManualTriggerExceptionProcessingFailureException
ExpiredPrivateKeyExceptionProcessingFailureException
ExpiredPublicKeyExceptionProcessingFailureException
ExportFailureExceptionProcessingFailureException
ExportNotReadyExceptionProcessingFailureException
FailedToChangePasswordExceptionProcessingFailureException
FileLockedExceptionProcessingFailureException
FileNotUploadedExceptionProcessingFailureException
FilePendingProcessingExceptionProcessingFailureException
FileProcessingErrorExceptionProcessingFailureException
FileTooBigToDecryptExceptionProcessingFailureException
FileTooBigToEncryptExceptionProcessingFailureException
FileUploadedToWrongRegionExceptionProcessingFailureException
FilenameTooLongExceptionProcessingFailureException
FolderLockedExceptionProcessingFailureException
FolderNotEmptyExceptionProcessingFailureException
HistoryUnavailableExceptionProcessingFailureException
InvalidBundleCodeExceptionProcessingFailureException
InvalidFileTypeExceptionProcessingFailureException
InvalidFilenameExceptionProcessingFailureException
InvalidPriorityColorExceptionProcessingFailureException
InvalidRangeExceptionProcessingFailureException
InvalidSiteExceptionProcessingFailureException
InvalidZipFileExceptionProcessingFailureException
MetadataNotSupportedOnRemotesExceptionProcessingFailureException
ModelSaveErrorExceptionProcessingFailureException
MultipleProcessingErrorsExceptionProcessingFailureException
PathTooLongExceptionProcessingFailureException
RecipientAlreadySharedExceptionProcessingFailureException
RemoteServerErrorExceptionProcessingFailureException
ResourceBelongsToParentSiteExceptionProcessingFailureException
ResourceLockedExceptionProcessingFailureException
SubfolderLockedExceptionProcessingFailureException
SyncInProgressExceptionProcessingFailureException
TwoFactorAuthenticationCodeAlreadySentExceptionProcessingFailureException
TwoFactorAuthenticationCountryBlacklistedExceptionProcessingFailureException
TwoFactorAuthenticationGeneralErrorExceptionProcessingFailureException
TwoFactorAuthenticationMethodUnsupportedErrorExceptionProcessingFailureException
TwoFactorAuthenticationUnsubscribedRecipientExceptionProcessingFailureException
UpdatesNotAllowedForRemotesExceptionProcessingFailureException
DuplicateShareRecipientExceptionRateLimitedException
ReauthenticationRateLimitedExceptionRateLimitedException
TooManyConcurrentLoginsExceptionRateLimitedException
TooManyConcurrentRequestsExceptionRateLimitedException
TooManyLoginAttemptsExceptionRateLimitedException
TooManyRequestsExceptionRateLimitedException
TooManySharesExceptionRateLimitedException
AutomationsUnavailableExceptionServiceUnavailableException
MigrationInProgressExceptionServiceUnavailableException
SiteDisabledExceptionServiceUnavailableException
UploadsUnavailableExceptionServiceUnavailableException
AccountAlreadyExistsExceptionSiteConfigurationException
AccountOverdueExceptionSiteConfigurationException
NoAccountForSiteExceptionSiteConfigurationException
SiteWasRemovedExceptionSiteConfigurationException
TrialExpiredExceptionSiteConfigurationException
TrialLockedExceptionSiteConfigurationException
UserRequestsEnabledRequiredExceptionSiteConfigurationException