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:
- SDK Exceptions - errors that originate within the SDK
- 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. The message of an exception for an HTTP error
response, from getMessage(), names the request's method and HTTP status, and for an API error its type; it never
quotes the response body or the request URL, which can contain credentials. The message of a transport error has
the request URL replaced with [redacted]. API exceptions provide the API's own error message and details through
getError(), getTitle() and the other getters listed below.
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\Exception\FilesException exception as a catch-all.
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.
The Api* exceptions below extend ApiConnectionException, which classifies how a request the SDK sent failed,
apart from an API error: the API could not be reached, the HTTP client failed, the API answered with a 5xx status,
or the SDK could not use the response.
SDK Exception Classes
| Exception Class Name | Description |
|---|---|
ApiConnectionException | The parent of the Api* exceptions below |
ApiBadResponseException | The SDK could not use the response, such as an HTTP error status below 500 without a readable Files.com error object, a model that is not a JSON object, a list that is not a JSON array, or a list cursor that was already followed |
ApiConnectException | The Files.com API cannot be reached, or the request timed out |
ApiRequestException | The HTTP client could not complete the request, for example because of a TLS error |
ApiServerException | The API service answered with a 5xx status, whatever the response body holds |
ApiTooManyRedirectsException | The API service redirected too many times |
ApiTransferException | The HTTP client failed to transfer the request |
ConfigurationException | Invalid SDK configuration parameters |
EmptyPropertyException | An required property was empty |
InvalidParameterException | A passed in parameter is invalid |
MissingParameterException | A method parameter is missing |
NotImplementedException | The 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.
An HTTP error response with a status below 500 whose body is a Files.com error object raises the exception class its
type names, or ApiException itself for a type the SDK does not recognize. The getters getType(),
getError(), getTitle(), getHttpCode(), getDetail(), getErrors() and getData() return the error object's
fields, or null for a field it does not include.
API Exception Classes
| Exception Class Name | Error Group |
|---|---|
AgentUpgradeRequiredException | BadRequestException |
AttachmentTooLargeException | BadRequestException |
CannotDownloadDirectoryException | BadRequestException |
CantMoveWithMultipleLocationsException | BadRequestException |
DatetimeParseException | BadRequestException |
DestinationSameException | BadRequestException |
DestinationSiteMismatchException | BadRequestException |
DoesNotSupportSortingException | BadRequestException |
FolderMustNotBeAFileException | BadRequestException |
FoldersNotAllowedException | BadRequestException |
InternalGeneralErrorException | BadRequestException |
InvalidBodyException | BadRequestException |
InvalidCursorException | BadRequestException |
InvalidCursorTypeForSortException | BadRequestException |
InvalidEtagsException | BadRequestException |
InvalidFilterAliasCombinationException | BadRequestException |
InvalidFilterFieldException | BadRequestException |
InvalidFilterParamException | BadRequestException |
InvalidFilterParamFormatException | BadRequestException |
InvalidFilterParamValueException | BadRequestException |
InvalidInputEncodingException | BadRequestException |
InvalidInterfaceException | BadRequestException |
InvalidOauthProviderException | BadRequestException |
InvalidPathException | BadRequestException |
InvalidReturnToUrlException | BadRequestException |
InvalidSearchQueryException | BadRequestException |
InvalidSortFieldException | BadRequestException |
InvalidSortFilterCombinationException | BadRequestException |
InvalidUploadOffsetException | BadRequestException |
InvalidUploadPartGapException | BadRequestException |
InvalidUploadPartSizeException | BadRequestException |
InvalidWorkspaceIdHeaderException | BadRequestException |
MethodNotAllowedException | BadRequestException |
MultipleSortParamsNotAllowedException | BadRequestException |
NoValidInputParamsException | BadRequestException |
OffsetUploadNotAllowedWithMalwareScanningException | BadRequestException |
PartNumberTooLargeException | BadRequestException |
PathCannotHaveTrailingWhitespaceException | BadRequestException |
ReauthenticationNeededFieldsException | BadRequestException |
RequestBodyTooLargeException | BadRequestException |
RequestParamsContainInvalidCharacterException | BadRequestException |
RequestParamsInvalidException | BadRequestException |
RequestParamsRequiredException | BadRequestException |
SearchAllOnChildPathException | BadRequestException |
UnrecognizedSortIndexException | BadRequestException |
UnsupportedCurrencyException | BadRequestException |
UnsupportedHttpResponseFormatException | BadRequestException |
UnsupportedMediaTypeException | BadRequestException |
UserIdInvalidException | BadRequestException |
UserIdOnUserEndpointException | BadRequestException |
UserRequiredException | BadRequestException |
AdditionalAuthenticationRequiredException | NotAuthenticatedException |
ApiKeySessionsNotSupportedException | NotAuthenticatedException |
AuthenticationRequiredException | NotAuthenticatedException |
BundleRegistrationCodeFailedException | NotAuthenticatedException |
InboxRegistrationCodeFailedException | NotAuthenticatedException |
InvalidCredentialsException | NotAuthenticatedException |
InvalidOauthException | NotAuthenticatedException |
InvalidOrExpiredCodeException | NotAuthenticatedException |
InvalidSessionException | NotAuthenticatedException |
InvalidUsernameOrPasswordException | NotAuthenticatedException |
LockedOutException | NotAuthenticatedException |
LockoutRegionMismatchException | NotAuthenticatedException |
OneTimePasswordIncorrectException | NotAuthenticatedException |
TwoFactorAuthenticationErrorException | NotAuthenticatedException |
TwoFactorAuthenticationSetupExpiredException | NotAuthenticatedException |
ApiKeyIsDisabledException | NotAuthorizedException |
ApiKeyIsPathRestrictedException | NotAuthorizedException |
ApiKeyOnlyForDesktopAppException | NotAuthorizedException |
ApiKeyOnlyForFileOperationsException | NotAuthorizedException |
ApiKeyOnlyForMobileAppException | NotAuthorizedException |
ApiKeyOnlyForOfficeIntegrationException | NotAuthorizedException |
BillingInformationHiddenException | NotAuthorizedException |
BillingPermissionRequiredException | NotAuthorizedException |
BundleMaximumUsesReachedException | NotAuthorizedException |
BundlePermissionRequiredException | NotAuthorizedException |
CannotAdministerHigherLevelUserException | NotAuthorizedException |
CannotLoginWhileUsingKeyException | NotAuthorizedException |
CantActForOtherUserException | NotAuthorizedException |
ContactAdminForPasswordChangeHelpException | NotAuthorizedException |
FilesAgentFailedAuthorizationException | NotAuthorizedException |
FolderAdminOrBillingPermissionRequiredException | NotAuthorizedException |
FolderAdminPermissionRequiredException | NotAuthorizedException |
FullPermissionRequiredException | NotAuthorizedException |
HistoryPermissionRequiredException | NotAuthorizedException |
InAppAiAssistantUnavailableException | NotAuthorizedException |
InsufficientPermissionForParamsException | NotAuthorizedException |
InsufficientPermissionForSiteException | NotAuthorizedException |
MoverAccessDeniedException | NotAuthorizedException |
MoverPackageRequiredException | NotAuthorizedException |
MustAuthenticateWithApiKeyException | NotAuthorizedException |
NeedAdminPermissionForInboxException | NotAuthorizedException |
NonAdminsMustQueryByFolderOrPathException | NotAuthorizedException |
NotAllowedToCreateBundleException | NotAuthorizedException |
NotEnqueuableSyncException | NotAuthorizedException |
PasswordChangeNotRequiredException | NotAuthorizedException |
PasswordChangeRequiredException | NotAuthorizedException |
PaymentMethodErrorException | NotAuthorizedException |
PreviewOnlyPermissionCannotDownloadException | NotAuthorizedException |
ReadOnlySessionException | NotAuthorizedException |
ReadPermissionRequiredException | NotAuthorizedException |
ReauthenticationFailedException | NotAuthorizedException |
ReauthenticationFailedFinalException | NotAuthorizedException |
ReauthenticationNeededActionException | NotAuthorizedException |
RecaptchaFailedException | NotAuthorizedException |
RemoteDesktopDebugLoggingDisabledException | NotAuthorizedException |
RootFolderBehaviorSiteAdminRequiredException | NotAuthorizedException |
RootFolderBehaviorSkipSiteAdminRequiredException | NotAuthorizedException |
SelfManagedRequiredException | NotAuthorizedException |
SiteAdminOrPartnerAdminPermissionRequiredException | NotAuthorizedException |
SiteAdminOrWorkspaceAdminOrFolderAdminPermissionRequiredException | NotAuthorizedException |
SiteAdminOrWorkspaceAdminOrPartnerAdminOrFolderAdminPermissionRequiredException | NotAuthorizedException |
SiteAdminOrWorkspaceAdminOrPartnerAdminPermissionRequiredException | NotAuthorizedException |
SiteAdminOrWorkspaceAdminPermissionRequiredException | NotAuthorizedException |
SiteAdminRequiredException | NotAuthorizedException |
SiteFilesAreImmutableException | NotAuthorizedException |
TwoFactorAuthenticationRequiredException | NotAuthorizedException |
UserIdWithoutSiteAdminException | NotAuthorizedException |
WriteAndBundlePermissionRequiredException | NotAuthorizedException |
WritePermissionRequiredException | NotAuthorizedException |
ApiKeyNotFoundException | NotFoundException |
BundlePathNotFoundException | NotFoundException |
BundleRegistrationNotFoundException | NotFoundException |
CodeNotFoundException | NotFoundException |
FileNotFoundException | NotFoundException |
FileUploadNotFoundException | NotFoundException |
GroupNotFoundException | NotFoundException |
InboxNotFoundException | NotFoundException |
NestedNotFoundException | NotFoundException |
PlanNotFoundException | NotFoundException |
SiteNotFoundException | NotFoundException |
UserNotFoundException | NotFoundException |
AgentPushUpdateBlockedException | ProcessingFailureException |
AgentUnavailableException | ProcessingFailureException |
AiTaskCannotBeRunManuallyException | ProcessingFailureException |
AlreadyCompletedException | ProcessingFailureException |
AutomationCannotBeRunManuallyException | ProcessingFailureException |
BehaviorNotAllowedOnRemoteServerException | ProcessingFailureException |
BufferedUploadDisabledForThisDestinationException | ProcessingFailureException |
BundleOnlyAllowsPreviewsException | ProcessingFailureException |
BundleOperationRequiresSubfolderException | ProcessingFailureException |
ConfigurationLockedPathException | ProcessingFailureException |
CouldNotCreateParentException | ProcessingFailureException |
DestinationExistsException | ProcessingFailureException |
DestinationFolderLimitedException | ProcessingFailureException |
DestinationParentConflictException | ProcessingFailureException |
DestinationParentDoesNotExistException | ProcessingFailureException |
ExceededRuntimeLimitException | ProcessingFailureException |
ExpectationAlreadyHasOpenWindowException | ProcessingFailureException |
ExpectationNotManualTriggerException | ProcessingFailureException |
ExpiredPrivateKeyException | ProcessingFailureException |
ExpiredPublicKeyException | ProcessingFailureException |
ExportFailureException | ProcessingFailureException |
ExportNotReadyException | ProcessingFailureException |
FailedToChangePasswordException | ProcessingFailureException |
FileLockedException | ProcessingFailureException |
FileNotUploadedException | ProcessingFailureException |
FilePendingProcessingException | ProcessingFailureException |
FileProcessingErrorException | ProcessingFailureException |
FileTooBigToDecryptException | ProcessingFailureException |
FileTooBigToEncryptException | ProcessingFailureException |
FileUploadedToWrongRegionException | ProcessingFailureException |
FilenameTooLongException | ProcessingFailureException |
FolderLockedException | ProcessingFailureException |
FolderNotEmptyException | ProcessingFailureException |
HistoryUnavailableException | ProcessingFailureException |
InvalidBundleCodeException | ProcessingFailureException |
InvalidFileTypeException | ProcessingFailureException |
InvalidFilenameException | ProcessingFailureException |
InvalidPriorityColorException | ProcessingFailureException |
InvalidRangeException | ProcessingFailureException |
InvalidSiteException | ProcessingFailureException |
InvalidZipFileException | ProcessingFailureException |
MetadataNotSupportedOnRemotesException | ProcessingFailureException |
ModelSaveErrorException | ProcessingFailureException |
MultipleProcessingErrorsException | ProcessingFailureException |
PathTooLongException | ProcessingFailureException |
RecipientAlreadySharedException | ProcessingFailureException |
RemoteEntryReadOnlyException | ProcessingFailureException |
RemoteServerErrorException | ProcessingFailureException |
ResourceBelongsToParentSiteException | ProcessingFailureException |
ResourceLockedException | ProcessingFailureException |
SubfolderLockedException | ProcessingFailureException |
SyncInProgressException | ProcessingFailureException |
TwoFactorAuthenticationCodeAlreadySentException | ProcessingFailureException |
TwoFactorAuthenticationCountryBlacklistedException | ProcessingFailureException |
TwoFactorAuthenticationGeneralErrorException | ProcessingFailureException |
TwoFactorAuthenticationMethodUnsupportedErrorException | ProcessingFailureException |
TwoFactorAuthenticationUnsubscribedRecipientException | ProcessingFailureException |
UpdatesNotAllowedForRemotesException | ProcessingFailureException |
DuplicateShareRecipientException | RateLimitedException |
FilesNativeStorageOverloadedException | RateLimitedException |
ReauthenticationRateLimitedException | RateLimitedException |
TooManyConcurrentLoginsException | RateLimitedException |
TooManyConcurrentRequestsException | RateLimitedException |
TooManyLoginAttemptsException | RateLimitedException |
TooManyRequestsException | RateLimitedException |
TooManySharesException | RateLimitedException |
AutomationsUnavailableException | ServiceUnavailableException |
LockOperationBusyException | ServiceUnavailableException |
MigrationInProgressException | ServiceUnavailableException |
SearchUnavailableException | ServiceUnavailableException |
SiteDisabledException | ServiceUnavailableException |
UploadsUnavailableException | ServiceUnavailableException |
AccountAlreadyExistsException | SiteConfigurationException |
AccountOverdueException | SiteConfigurationException |
NoAccountForSiteException | SiteConfigurationException |
SiteWasRemovedException | SiteConfigurationException |
TrialExpiredException | SiteConfigurationException |
TrialLockedException | SiteConfigurationException |
UserRequestsEnabledRequiredException | SiteConfigurationException |