Skip Navigation Links
Skip Navigation LinksHome > ZipArchive > How to Use > API Documentation
The ZipArchive Library

#include <ZipException.h>

Inheritance diagram for CZipException:
Inheritance graph

Public Types

enum  ZipErrors {
  noError , genericError = 200 , badZipFile , badCrc ,
  noCallback , noVolumeSize , aborted , abortedAction ,
  abortedSafely , nonRemovable , tooManyVolumes , tooManyFiles ,
  tooLongData , tooBigSize , badPassword , dirWithSize ,
  internalError , fileError , notFound , notRemoved ,
  notRenamed , platfNotSupp , cdirNotFound , noZip64 ,
  noAES , cdir64NotFound = 400 , noBBZInZip64 , badAesAuthCode = 425 ,
  outOfBounds = 450 , mutexError = 475 , streamEnd = 500 , needDict ,
  errNo , streamError , dataError , memError ,
  bufError , versionError , bzSequenceError = 600 , bzParamError ,
  bzMemError , bzDataError , bzDataErrorMagic , bzIoError ,
  bzUnexpectedEof , bzOutbuffFull , bzConfigError , bzInternalError ,
  zstdErrorMin = 1000 , zstdErrorMax = 2000 , zstdConfigError
}

Public Member Functions

 CZipException (CZipException &e)
 CZipException (int iCause=genericError, LPCTSTR lpszZipName=NULL)
CZipString GetErrorDescription () const
ZBOOL GetErrorMessage (LPTSTR lpszError, UINT nMaxError, UINT *=NULL)

Static Public Member Functions

static void Throw (int iCause=CZipException::genericError, LPCTSTR lpszZipName=NULL)

Public Attributes

int m_iCause
ZIP_SYSTEM_ERROR_TYPE m_iSystemError
CZipString m_szFileName

Protected Member Functions

CZipString GetInternalErrorDescription (int iCause, bool bNoLoop=false) const
CZipString GetSystemErrorDescription () const

Detailed Description

Represents exceptions specific to the ZipArchive Library.

See also
Exceptions Handling

Member Enumeration Documentation

◆ ZipErrors

The codes of errors thrown by the ZipArchive Library.

Enumerator
noError 

No error.

genericError 

An unspecified error.

badZipFile 

Damaged or not a zip file.

badCrc 

Crc is mismatched.

noCallback 

There is no spanned archive callback object set.

noVolumeSize 

The volume size was not defined for a split archive.

aborted 

The volume change callback in a segmented archive method returned false.

abortedAction 

The action callback method returned false.

abortedSafely 

The action callback method returned false, but the data is not corrupted.

nonRemovable 

The device selected for the spanned archive is not removable.

tooManyVolumes 

The limit of the maximum number of volumes has been reached.

tooManyFiles 

The limit of the maximum number of files in an archive has been reached.

tooLongData 

The filename, the comment or local or central extra field of the file added to the archive is too long.

tooBigSize 

The file size is too large to be supported.

badPassword 

An incorrect password set for the file being decrypted.

dirWithSize 

The directory with a non-zero size found while testing.

internalError 

An internal error.

fileError 

A file error occurred. Examine m_iSystemError for more information.

notFound 

A file was not found.

notRemoved 

Error while removing a file. Examine m_iSystemError for more information.

notRenamed 

Error while renaming a file. Examine m_iSystemError for more information.

platfNotSupp 

Cannot create a file for the specified platform.

cdirNotFound 

The central directory was not found in the archive (or you were trying to open not the last disk of a segmented archive).

noZip64 

The Zip64 format has not been enabled for the library, but is required to use the archive.

noAES 

WinZip AES encryption has not been enabled for the library, but is required to decompress the archive.

cdir64NotFound 

The Zip64 central directory signature was not found in the archive where expected.

noBBZInZip64 

The number of bytes before a zip archive must be zero in the Zip64 format.

badAesAuthCode 

Mismatched authentication code in WinZip AEC decrypted data.

outOfBounds 

The collection is empty and the bounds do not exist.

mutexError 

Locking or unlocking resources access was unsuccessful.

streamEnd 

Zlib library error.

needDict 

Zlib library error.

errNo 

Zlib library error.

streamError 

Zlib library error.

dataError 

Zlib library error.

memError 

Zlib library or CZipMemFile error.

bufError 

Zlib library error.

versionError 

Zlib library error.

bzSequenceError 

Bzlib library error.

bzParamError 

Bzlib library error.

bzMemError 

Bzlib library error.

bzDataError 

Bzlib library error.

bzDataErrorMagic 

Bzlib library error.

bzIoError 

Bzlib library error.

bzUnexpectedEof 

Bzlib library error.

bzOutbuffFull 

Bzlib library error.

bzConfigError 

Bzlib library error.

bzInternalError 

Internal Bzlib library error.

zstdErrorMin 

Zstd min library error.

zstdErrorMax 

Zstd max library error.

zstdConfigError 

Unsupported Zstd configuration.

Constructor & Destructor Documentation

◆ CZipException() [1/2]

CZipException::CZipException ( int iCause = genericError,
LPCTSTR lpszZipName = NULL )

Initializes a new instance of the CZipException class.

Parameters
iCauseThe error cause. Takes one of the ZipErrors values.
lpszZipNameThe name of the file where the error occurred (if applicable). May be NULL.

◆ CZipException() [2/2]

CZipException::CZipException ( CZipException & e)
inline

Copy constructor.

Parameters
eThe exception to copy from.

Member Function Documentation

◆ GetErrorDescription()

CZipString CZipException::GetErrorDescription ( ) const

Returns the error description.

Returns
The error description.

◆ GetErrorMessage()

ZBOOL CZipException::GetErrorMessage ( LPTSTR lpszError,
UINT nMaxError,
UINT * = NULL )

Returns the error description. This method is provided for compatibility with the MFC version (CException::GetErrorMessage).

Parameters
lpszErrorThe buffer to receive the error message.
nMaxErrorThe maximum number of characters lpszError can hold, including the ending NULL character.
Returns
TRUE if the error string was successfully copied to lpszError; FALSE otherwise.
Note
The method will not copy more than nMaxError - 1 characters to the buffer, and it always appends a NULL character. If lpszError is too small, the error message will be truncated.

◆ GetInternalErrorDescription()

CZipString CZipException::GetInternalErrorDescription ( int iCause,
bool bNoLoop = false ) const
protected

Returns the error description.

Parameters
iCauseThe error cause. Takes one of the ZipErrors values.
bNoLoopIf true, does not search for en error description, it the error code is genericError.
Returns
The error description.

◆ GetSystemErrorDescription()

CZipString CZipException::GetSystemErrorDescription ( ) const
protected

Returns the error description based on system variables.

Returns
The error description.

◆ Throw()

void CZipException::Throw ( int iCause = CZipException::genericError,
LPCTSTR lpszZipName = NULL )
inlinestatic

Throws an exception. Whether it throws an object or a pointer to it, depends on the current version (STL or MFC correspondingly).

Parameters
iCauseThe error cause. It takes one of the ZipErrors values.
lpszZipNameThe name of the file where the error occurred (if applicable). May be NULL.
See also
Exceptions Handling

Member Data Documentation

◆ m_iCause

int CZipException::m_iCause

The error code. It takes one of the CZipException::ZipErrors values.

◆ m_iSystemError

ZIP_SYSTEM_ERROR_TYPE CZipException::m_iSystemError

An error code reported by the system during the recent operation. It is set to GetLastError() value on Windows and to errno on other platforms.

◆ m_szFileName

CZipString CZipException::m_szFileName

The name of the archive for which the error occurred.


The documentation for this class was generated from the following file:
Back To Top Up