![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include <error.hh>
Public Member Functions | |
| BaseError (const BaseError &)=default | |
| BaseError & | operator= (const BaseError &)=default |
| BaseError & | operator= (BaseError &&) noexcept=default |
| template<typename... Args> | |
| BaseError (unsigned int status, Args &&... args) | |
| template<typename... Args> | |
| BaseError (const std::string &fs, Args &&... args) | |
| template<typename... Args> | |
| BaseError (const Suggestions &sug, Args &&... args) | |
| BaseError (HintFmt hint) | |
| BaseError (ErrorInfo &&e) | |
| BaseError (const ErrorInfo &e) | |
| std::string | message () const |
| const char * | what () const noexcept override |
| const std::string & | msg () const |
| const ErrorInfo & | info () const |
| void | withExitStatus (unsigned int status) |
| void | atPos (std::shared_ptr< const Pos > pos) |
| bool | hasPos () const |
| void | pushTrace (Trace trace) |
| template<typename... Args> | |
| void | addTrace (std::shared_ptr< const Pos > &&pos, std::string_view fs, Args &&... args) |
| void | addTrace (std::shared_ptr< const Pos > &&pos, HintFmt hint, TracePrint print=TracePrint::Default) |
| bool | hasTrace () const |
| ErrorInfo & | unsafeInfo () |
| void | recalcWhat () const |
| virtual void | throwClone () const =0 |
Protected Member Functions | |
| const std::string & | calcWhat () const |
Protected Attributes | |
| ErrorInfo | err |
| std::optional< std::string > | what_ |
| void nix::BaseError::addTrace | ( | std::shared_ptr< const Pos > && | pos, |
| HintFmt | hint, | ||
| TracePrint | print = TracePrint::Default ) |
Prepends an item to the error trace, as is usual for extra context.
| pos | Nullable source position to put in trace item |
| hint | Formatted error message |
| Optional, whether to always print (used by addErrorContext) |
|
inline |
Prepends an item to the error trace, as is usual for extra context.
| pos | Nullable source position to put in trace item |
| fs | Format string, see HintFmt |
| args | Format string arguments. |
|
protected |
Format err.msg and set what_ to the resulting value.
|
inline |
The error message without "error: " prefixed to it.
| void nix::BaseError::recalcWhat | ( | ) | const |
Recalculate the cached formatted error message. Must be called after modifying the error info via unsafeInfo().
|
pure virtual |
Implemented in nix::CloneableError< BadNixStringContextElem, Error >, nix::CloneableError< BuildEnvFileConflictError, Error >, nix::CloneableError< BuilderFailureError, BuildError >, nix::CloneableError< BuildError, Error >, nix::CloneableError< Error, BaseError >, nix::CloneableError< EvalBaseError, Error >, nix::CloneableError< ExecError, Error >, nix::CloneableError< FileTransferError, Error >, nix::CloneableError< InvalidSSHAuthority, Error >, nix::CloneableError< MissingExperimentalFeature, Error >, nix::CloneableError< MissingRealisation, Error >, nix::CloneableError< NotDeterministic, BuildError >, nix::CloneableError< ParseError, Error >, nix::CloneableError< SQLiteError, Error >, nix::CloneableError< StackOverflowError, EvalBaseError >, nix::CloneableError< SymlinkNotAllowed, Error >, nix::CloneableError< SysError, NativeCodeSystemError< SysErrorFields, &SysErrorFields::errNo > >, nix::CloneableError< SystemError, Error >, nix::CloneableError< TimedOut, BuildError >, nix::CloneableError< UnimplementedError, Error >, and nix::CloneableError< UsageError, Error >.
|
inline |
Returns a mutable reference to the error info.
|
mutableprotected |
Cached formatted contents of err.msg.