AFIO  v2.00 late alpha
afio_v2_xxx::error_info Struct Reference

The cause of the failure of an operation in AFIO. More...

#include "config.hpp"

Public Member Functions

 error_info ()=default
 Default constructor.
 
 error_info (int code, const std::error_category &cat)
 Construct from a code and error category.
 
 error_info (std::error_code _ec)
 
 OUTCOME_TEMPLATE (class ErrorCondEnum) OUTCOME_TREQUIRES(OUTCOME_TPRED(std
 Construct from an error condition enum.
 
filesystem::path path1 () const
 Retrieve any first path associated with this failure. Note this only works if called from the same thread as where the failure occurred.
 
filesystem::path path2 () const
 Retrieve any second path associated with this failure. Note this only works if called from the same thread as where the failure occurred.
 
std::string message () const
 Retrieve a descriptive message for this failure, possibly with paths and stack backtraces. Extra detail only appears if called from the same thread as where the failure occurred.
 
void throw_as_exception () const
 

Public Attributes

std::error_code ec
 The error code for the failure.
 

Detailed Description

The cause of the failure of an operation in AFIO.

Member Function Documentation

◆ throw_as_exception()

void afio_v2_xxx::error_info::throw_as_exception ( ) const
inline

Throw this failure as a C++ exception. Firstly if the error code matches any of the standard C++ exception types e.g. bad_alloc, we throw those types using the string from message() where possible. We then will throw an error exception type.

413 {
414  std::string msg;
415  try
416  {
417  msg = message();
418  }
419  catch(...)
420  {
421  }
422  OUTCOME_V2_NAMESPACE::try_throw_std_exception_from_error(ec, msg);
423  throw error(*this);
424 }
std::error_code ec
The error code for the failure.
Definition: config.hpp:319
std::string message() const
Retrieve a descriptive message for this failure, possibly with paths and stack backtraces. Extra detail only appears if called from the same thread as where the failure occurred.
Definition: config.hpp:572

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