Lightweight 0.20251202.0
Loading...
Searching...
No Matches
Lightweight::Zip::ZipError Struct Reference

Represents an error that occurred during a ZIP operation. More...

#include <ZipError.hpp>

Static Public Member Functions

static ZipError FromArchive (zip_t *zip, ZipErrorCode code)
 
static ZipError FromOpenError (int errorCode, ZipErrorCode code)
 
static ZipError Custom (ZipErrorCode code, std::string msg)
 

Public Attributes

ZipErrorCode code {}
 The error code.
 
int libzipError {}
 Original libzip error code (0 if not from libzip)
 
std::string message
 Human-readable error message.
 

Detailed Description

Represents an error that occurred during a ZIP operation.

Definition at line 33 of file ZipError.hpp.

Member Function Documentation

◆ FromArchive()

static ZipError Lightweight::Zip::ZipError::FromArchive ( zip_t *  zip,
ZipErrorCode  code 
)
inlinestatic

Creates a ZipError from the current error state of a ZIP archive.

Parameters
zipThe ZIP archive handle to extract the error from.
codeThe error code to assign.
Returns
A ZipError populated with the libzip error information.

Definition at line 44 of file ZipError.hpp.

References code.

◆ FromOpenError()

static ZipError Lightweight::Zip::ZipError::FromOpenError ( int  errorCode,
ZipErrorCode  code 
)
inlinestatic

Creates a ZipError from an open error code.

Parameters
errorCodeThe libzip error code from zip_open.
codeThe error code to assign.
Returns
A ZipError populated with the error information.

Definition at line 59 of file ZipError.hpp.

References code, and message.

◆ Custom()

static ZipError Lightweight::Zip::ZipError::Custom ( ZipErrorCode  code,
std::string  msg 
)
inlinestatic

Creates a custom ZipError with a user-defined message.

Parameters
codeThe error code.
msgThe error message.
Returns
A ZipError with the specified code and message.

Definition at line 77 of file ZipError.hpp.

References code.

Member Data Documentation

◆ code

ZipErrorCode Lightweight::Zip::ZipError::code {}

The error code.

Definition at line 35 of file ZipError.hpp.

Referenced by Custom(), FromArchive(), and FromOpenError().

◆ libzipError

int Lightweight::Zip::ZipError::libzipError {}

Original libzip error code (0 if not from libzip)

Definition at line 36 of file ZipError.hpp.

◆ message

std::string Lightweight::Zip::ZipError::message

Human-readable error message.

Definition at line 37 of file ZipError.hpp.

Referenced by FromOpenError().


The documentation for this struct was generated from the following file: