Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
nix::BaseError Class Reference

#include <error.hh>

Inheritance diagram for nix::BaseError:

Public Member Functions

 BaseError (const BaseError &)=default
 
BaseErroroperator= (const BaseError &)=default
 
BaseErroroperator= (BaseError &&)=default
 
template<typename... Args>
 BaseError (unsigned int status, const Args &... args)
 
template<typename... Args>
 BaseError (const std::string &fs, const Args &... args)
 
template<typename... Args>
 BaseError (const Suggestions &sug, const Args &... args)
 
 BaseError (HintFmt hint)
 
 BaseError (ErrorInfo &&e)
 
 BaseError (const ErrorInfo &e)
 
std::string message ()
 
const charwhat () const noexcept override
 
const std::string & msg () const
 
const ErrorInfoinfo () const
 
void withExitStatus (unsigned int status)
 
void atPos (std::shared_ptr< Pos > pos)
 
void pushTrace (Trace trace)
 
template<typename... Args>
void addTrace (std::shared_ptr< Pos > &&e, std::string_view fs, const Args &... args)
 
void addTrace (std::shared_ptr< Pos > &&e, HintFmt hint, TracePrint print=TracePrint::Default)
 
bool hasTrace () const
 
const ErrorInfoinfo ()
 

Protected Member Functions

const std::string & calcWhat () const
 

Protected Attributes

ErrorInfo err
 
std::optional< std::string > what_
 

Detailed Description

BaseError should generally not be caught, as it has Interrupted as a subclass. Catch Error instead.

Member Function Documentation

◆ calcWhat()

const std::string & nix::BaseError::calcWhat ( ) const
protected

Format err.msg and set what_ to the resulting value.

◆ message()

std::string nix::BaseError::message ( )
inline

The error message without "error: " prefixed to it.

Member Data Documentation

◆ what_

std::optional<std::string> nix::BaseError::what_
mutableprotected

Cached formatted contents of err.msg.


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