wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
error.hpp File Reference

The error-handling vocabulary: ErrorCode, Error and the Result<T> alias every fallible wowlib operation returns. More...

#include <cstdint>
#include <expected>
#include <string>
#include <wowlib/core/reflect.hpp>
Include dependency graph for error.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wowlib::Error
 A wowlib operation failure: a machine-readable code, a human-readable message, and the originating native (StormLib/CascLib/OS) error value when one exists. More...

Namespaces

namespace  wowlib

Typedefs

template<typename T>
using wowlib::Result = std::expected<T, Error>
 Every fallible wowlib operation returns Result<T>; bindings translate the error branch into a target-language exception.

Enumerations

enum class  wowlib::ErrorCode : std::uint32_t {
  wowlib::StorageOpenFailed , wowlib::ArchiveOpenFailed , wowlib::StorageNotOpen , wowlib::FileNotFound ,
  wowlib::PathNotResolvable , wowlib::FdidNotResolvable , wowlib::ListfileParseError , wowlib::ListfileIoError ,
  wowlib::FdidSpaceExhausted , wowlib::DuplicatePath , wowlib::InvalidPath , wowlib::IoError ,
  wowlib::EncryptedContent , wowlib::NotSupported , wowlib::NotImplemented , wowlib::BackendError ,
  wowlib::ChunkTruncated , wowlib::ChunkSizeMismatch , wowlib::ChunkMissing , wowlib::OffsetOutOfBounds ,
  wowlib::InvalidEntityState , wowlib::FormatVersionMismatch , wowlib::UnsupportedClientVersion , wowlib::TableTruncated ,
  wowlib::TableMagicUnknown , wowlib::SchemaMismatch , wowlib::SchemaBlobInvalid , wowlib::TableUnknown
}
 Machine-readable failure category carried by every Error. More...

Functions

constexpr std::string_view wowlib::to_string (ErrorCode code)
 The enumerator spelling of code, obtained via reflection.
std::string wowlib::to_string (const Error &error)
 The human-readable rendering of error: its code spelling, its message, and the native error value when there is one.
std::unexpected< Error > wowlib::makeError (ErrorCode code, std::string message, std::uint32_t nativeError=0)
 Shorthand for constructing the error branch of a Result.

Detailed Description

The error-handling vocabulary: ErrorCode, Error and the Result<T> alias every fallible wowlib operation returns.

Bindings translate the error branch into target-language exceptions.

Definition in file error.hpp.