Module: CloudFS::RestAdapter::Errors
- Defined in:
- lib/cloudfs/client/error.rb
Overview
Defines exceptional behavior. Error is base class of all exceptions raised by CloudFS SDK. ServiceError is base class of all errors returned by CloudFS service. Other exceptions are ArgumentError, ClientError, InvalidItemError, InvalidShareError, OperationNotAllowedError, SessionNotLinked
Defined Under Namespace
Classes: APICallLimitReached, APIError, AlreadyExists, ArgumentError, CannotDeleteTheInfiniteDrive, ClientError, ConnectionFailed, CopyToReadOnlyDestinationFailed, CreateFolderOnReadOnlyLocationFailed, DeleteOnReadOnlyLocationFailed, DirectoryNotEmpty, EndpointError, Error, ExistsParameterInvalid, ExtensionTooLong, FailedToBroadcastUpdate, FailedToReadFilesystem, FailedToSaveChanges, FileError, FileInvalidName, FileInvalidOperation, FileSystemError, FileVersionMissingOrIncorrect, FolderDoesNotExist, FolderError, FolderMissingToParameter, FolderNameRequired, FolderNotFound, FolderPathDoesNotExist, GeneralPanicError, HttpError, InvalidDateContentLastModified, InvalidDateCreated, InvalidDateMetaLastModified, InvalidDepth, InvalidExists, InvalidItemError, InvalidName, InvalidOperation, InvalidPath, InvalidShareError, InvalidVerbose, InvalidVersion, MIMETooLong, MissingPathParameter, MoveToReadOnlyDestinationFailed, NameConflictCreatingFolder, NameConflictInOperation, NameConflictOnCopy, NameConflictOnMove, NameConflictOnRename, NameConflictOnUpload, NameRequired, NotAllowed, NotFound, OperationNotAllowedError, OrigionalPathNoLongerExists, PermissionDenied, RenameOnReadOnlyLocationFailed, RenamePermissionDenied, ServerError, ServiceError, SessionNotLinked, ShareDoesNotExist, ShareError, SharePathDoesNotExist, SharePathRequired, SizeMustBePositive, SizeRequired, SpecifiedDestinationIsReadOnly, SpecifiedLocationIsReadOnly, SpecifiedSourceIsReadOnly, TimeoutError, ToPathRequired, TreeRequired, UploadToReadOnlyDestinationFailed, VersionDoesNotExist, VersionMismatchIgnored, VersionMissingOrIncorrect, WouldExceedQuota
Constant Summary collapse
- BITCASA_ERRORS =
Maps exception classes to error codes returned by CloudFS Service
{ 9999 => 'GeneralPanicError', 9000 => 'APIError', 9006 => 'APICallLimitReached', # FileSystem errors 8001 => 'InvalidVersion', 8002 => 'VersionMismatchIgnored', 8004 => 'OrigionalPathNoLongerExists', # Shares errors 6001 => 'SharePathRequired', 6002 => 'SharePathDoesNotExist', 6003 => 'WouldExceedQuota', 6004 => 'ShareDoesNotExist', # Folder errors 2002 => 'FolderDoesNotExist', 2003 => 'FolderNotFound', 2004 => 'UploadToReadOnlyDestinationFailed', 2005 => 'MoveToReadOnlyDestinationFailed', 2006 => 'CopyToReadOnlyDestinationFailed', 2007 => 'RenameOnReadOnlyLocationFailed', 2008 => 'DeleteOnReadOnlyLocationFailed', 2009 => 'CreateFolderOnReadOnlyLocationFailed', 2010 => 'FailedToReadFilesystem', 2011 => 'FailedToReadFilesystem', 2012 => 'FailedToReadFilesystem', 2013 => 'FailedToReadFilesystem', 2014 => 'NameConflictCreatingFolder', 2015 => 'NameConflictOnUpload', 2016 => 'NameConflictOnRename', 2017 => 'NameConflictOnMove', 2018 => 'NameConflictOnCopy', 2019 => 'FailedToSaveChanges', 2020 => 'FailedToSaveChanges', 2021 => 'FailedToSaveChanges', 2022 => 'FailedToBroadcastUpdate', 2023 => 'FailedToBroadcastUpdate', 2024 => 'FailedToSaveChanges', 2025 => 'FailedToSaveChanges', 2026 => 'CannotDeleteTheInfiniteDrive', 2028 => 'MissingToParameter"', 2033 => 'ExistsParameterInvalid', 2034 => 'MissingPathParameter', 2036 => 'SpecifiedLocationIsReadOnly', 2037 => 'SpecifiedSourceIsReadOnly', 2038 => 'SpecifiedDestinationIsReadOnly', 2039 => 'FolderPathDoesNotExist', 2040 => 'PermissionDenied', 2041 => 'RenamePermissionDenied', 2042 => 'NameConflictInOperation', 2043 => 'InvalidOperation', 2044 => 'VersionMissingOrIncorrect', 2045 => 'InvalidDepth', 2046 => 'VersionDoesNotExist', 2047 => 'FolderNameRequired', 2048 => 'InvalidName', 2049 => 'TreeRequired', 2050 => 'InvalidVerbose', 2052 => 'DirectoryNotEmpty', # File errors 3001 => 'NotFound', 3007 => 'InvalidOperation', 3008 => 'InvalidName', 3009 => 'InvalidExists', 3010 => 'ExtensionTooLong', 3011 => 'InvalidDateCreated', 3012 => 'InvalidDateMetaLastModified', 3013 => 'InvalidDateContentLastModified', 3014 => 'MIMETooLong', 3015 => 'SizeMustBePositive', 3018 => 'NameRequired', 3019 => 'SizeRequired', 3020 => 'ToPathRequired', 3021 => 'VersionMissingOrIncorrect', # Endpoint Entry Errors 10000 => 'InvalidPath', 10001 => 'AlreadyExists', 10002 => 'NotAllowed' }
Class Method Summary collapse
-
.raise_service_error(error) ⇒ Object
Raises specific exception mapped by CloudFS error code in json message.
Class Method Details
.raise_service_error(error) ⇒ Object
Raises specific exception mapped by CloudFS error code in json message
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/cloudfs/client/error.rb', line 431
def self.raise_service_error(error)
begin
hash = Utils.json_to_hash(error.message)
rescue StandardError
raise ServiceError.new(error.message, error)
end
raise ServiceError.new(error.message, error) unless hash.key?(:error)
if hash[:error].is_a?(Hash)
code, message = Utils.hash_to_arguments(hash[:error],
:code, :message)
else
message = hash.fetch(:message) { hash[:error] }
code = hash.fetch(:error_code, nil)
end
raise ServiceError.new(message, error) unless code && BITCASA_ERRORS.key?(code)
raise const_get(BITCASA_ERRORS[code]).new(message, error)
end
|