Source code for twain.exceptions
[docs]
class TwainError(Exception):
"""
Base error for all errors returned by TWAIN driver
"""
[docs]
class DSTransferCancelled(TwainError):
"""
Data transfer was cancelled by user
"""
[docs]
class SMGetProcAddressFailed(TwainError):
"""
Specified driver does not have DSM_Entry symbol defined
"""
[docs]
class SMLoadFileFailed(TwainError):
"""
Failed to load DLL
"""
[docs]
class SMOpenFailed(TwainError):
"""
DSM entry point returned error when called.
"""
[docs]
class BadCapability(TwainError):
"""
Source does not support specified capability.
Sources newer than 1.6 do not use report this error.
"""
[docs]
class BadDestination(TwainError):
"""
Operation was sent to invalid Source
"""
[docs]
class BadProtocol(TwainError):
"""
Operation is not recognized by Source
"""
[docs]
class GeneralFailure(TwainError):
"""General failure. Unload Source immediately."""
[docs]
class CapBadOperation(TwainError):
"""Operation (i.e., Get or Set) not supported on capability."""
[docs]
class CapSeqError(TwainError):
"""Capability has dependencies on other capabilities and
cannot be operated upon at this time.
"""
[docs]
class CapUnsupported(TwainError):
"""
Capability not supported by Source.
Sources with version 1.6 and newer use this error instead of BadCapability error
"""
[docs]
class CheckDeviceOnlineError(TwainError):
"""Check the device status using CAP_DEVICEONLINE, this
condition code can be returned by any TWAIN operation
in state 4 or higher, or from the state 3 DG_CONTROL /
DAT_IDENTITY / MSG_OPENDS. The state remains
unchanged. If in state 4 the Application can poll with
CAP_DEVICELINE until the value returns TRUE.
"""
[docs]
class DeniedError(TwainError):
"""
Operation denied
"""
[docs]
class FileWriteError(TwainError):
"""
Operation failed writing to the file.
"""
[docs]
class MaxConnectionsError(TwainError):
"""
Device is connected to maximum number of applications it can support.
"""
[docs]
class NoDataSourceError(TwainError):
"""
No Source found
"""
[docs]
class NotEmptyError(TwainError):
"""
Directory not empty and cannot be deleted
"""
[docs]
class OperationError(TwainError):
"""Internal Source error"""
[docs]
class PaperDoubleFeedError(TwainError):
"""
Feeder error. This error is obsolete but may still be reported by older sources.
"""
[docs]
class PaperJam(TwainError):
"""
Paper got stuck in feeder
"""
[docs]
class SequenceError(TwainError):
"""
Operation was called at a wrong state
"""
[docs]
class UnknownError(TwainError):
"""
Unknown error code was returned.
Probably need to upgrade pytds to newer version.
"""
[docs]
class CancelAll(Exception):
"""Exception used by callbacks to cancel remaining image transfers"""
[docs]
class CheckStatus(Exception):
"""This exception means that operation succeeded but user value was truncated
to fit valid range
"""
# Following exception aliases are deprecated
# and will be removed in version 2.4.0
excCapabilityFormatNotSupported = CapabilityFormatNotSupported
excDSTransferCancelled = DSTransferCancelled
excSMGetProcAddressFailed = SMGetProcAddressFailed
excSMLoadFileFailed = SMLoadFileFailed
excSMOpenFailed = SMOpenFailed
excImageFormat = ImageFormatNotSupported
excTWCC_BADCAP = BadCapability
excTWCC_BADDEST = BadDestination
excTWCC_BADPROTOCOL = BadProtocol
excTWCC_BUMMER = GeneralFailure
excTWCC_CAPBADOPERATION = CapBadOperation
excTWCC_CAPSEQERROR = CapSeqError
excTWCC_CAPUNSUPPORTED = CapUnsupported
excTWCC_CHECKDEVICEONLINE = CheckDeviceOnlineError
excTWCC_DENIED = DeniedError
excTWCC_FILEEXISTS = FileExistsError
excTWCC_FILEWRITEERROR = FileWriteError
excTWCC_MAXCONNECTIONS = MaxConnectionsError
excTWCC_NODS = NoDataSourceError
excTWCC_NOTEMPTY = NotEmptyError
excTWCC_OPERATIONERROR = OperationError
excTWCC_PAPERDOUBLEFEED = PaperDoubleFeedError
excTWCC_PAPERJAM = PaperJam
excTWCC_SEQERROR = SequenceError
excTWCC_UNKNOWN = UnknownError