Porytiles
Loading...
Searching...
No Matches
porytiles::Error Class Referenceabstract

Abstract interface for all error types used in ChainableResult error chains. More...

#include <error.hpp>

Inheritance diagram for porytiles::Error:
[legend]

Public Member Functions

virtual ~Error ()=default
 
virtual std::vector< std::string > details (const TextFormatter &formatter) const =0
 Returns a formatted multi-line string representation of the error.
 
virtual std::string join (const TextFormatter &formatter, const std::string &delimiter="\n") const
 
virtual std::unique_ptr< Errorclone () const =0
 

Detailed Description

Abstract interface for all error types used in ChainableResult error chains.

All concrete error types used with ChainableResult must derive from this interface. Implementations should be immutable value types that capture all relevant context about a failure. The clone pattern enables proper copying of errors when building error chains.

Definition at line 19 of file error.hpp.

Constructor & Destructor Documentation

◆ ~Error()

virtual porytiles::Error::~Error ( )
virtualdefault

Member Function Documentation

◆ clone()

virtual std::unique_ptr< Error > porytiles::Error::clone ( ) const
pure virtual

◆ details()

virtual std::vector< std::string > porytiles::Error::details ( const TextFormatter formatter) const
pure virtual

Returns a formatted multi-line string representation of the error.

Each element in the returned vector represents one line of the error message. The TextFormatter controls whether ANSI styling codes are included based on TTY status.

Parameters
formatterThe TextFormatter to use for conditional formatting based on TTY status
Returns
A vector of formatted strings describing the error, one per line

Implemented in porytiles::ImageLoadError, and porytiles::FormattableError.

◆ join()

virtual std::string porytiles::Error::join ( const TextFormatter formatter,
const std::string &  delimiter = "\n" 
) const
inlinevirtual

Definition at line 35 of file error.hpp.


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