Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::SysError Class Referencefinal

#include <system-error.hh>

Inheritance diagram for nix::SysError:
nix::CloneableError< SysError, NativeCodeSystemError< SysErrorFields, &SysErrorFields::errNo > > nix::NativeCodeSystemError< SysErrorFields, &SysErrorFields::errNo > nix::SysErrorFields nix::SystemError nix::CloneableError< SystemError, Error > nix::Error nix::CloneableError< Error, BaseError > nix::BaseError

Additional Inherited Members

Public Types inherited from nix::NativeCodeSystemError< SysErrorFields, &SysErrorFields::errNo >
using NativeCode
Public Member Functions inherited from nix::CloneableError< SysError, NativeCodeSystemError< SysErrorFields, &SysErrorFields::errNo > >
void throwClone () const override
Public Member Functions inherited from nix::NativeCodeSystemError< SysErrorFields, &SysErrorFields::errNo >
 NativeCodeSystemError (NativeCode code, Args &&... args)
Public Member Functions inherited from nix::SystemError
 SystemError (std::error_code errorCode, const HintFmt &hf)
template<typename... Args>
 SystemError (std::error_code errorCode, Args &&... args)
const std::error_code ec () const &
bool is (std::errc e) const
template<std::same_as< std::errc >... Rest>
bool is (std::errc e, Rest... rest) const
Public Member Functions inherited from nix::CloneableError< SystemError, Error >
void throwClone () const override
Public Member Functions inherited from nix::BaseError
 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
Static Public Member Functions inherited from nix::SysErrorFields
static int ambientError ()
static std::error_code toErrorCode (int code)
static std::string renderError (int code)
Public Attributes inherited from nix::SysErrorFields
int errNo
Protected Member Functions inherited from nix::SystemError
 SystemError (DisambigHintFmt, std::error_code errorCode, std::string_view errorDetails, const HintFmt &hf)
template<typename... Args>
 SystemError (DisambigVarArgs, std::error_code errorCode, std::string_view errorDetails, Args &&... args)
Protected Member Functions inherited from nix::BaseError
const std::string & calcWhat () const
Protected Attributes inherited from nix::BaseError
ErrorInfo err
std::optional< std::string > what_

Detailed Description

POSIX system error, created using errno, strerror friends.

Throw this, but prefer not to catch this, and catch SystemError instead. This allows implementations to freely switch between this and windows::WinError without breaking catch blocks.

However, it is permissible to catch this and rethrow so long as certain conditions are not met (e.g. to catch only if errNo = EFooBar). In that case, try to also catch the equivalent windows::WinError code.

Todo
Rename this to PosixError or similar. At this point Windows support is too WIP to justify the code churn, but if it is finished then a better identifier becomes moe worth it.

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