LLFIO v2.00
Loading...
Searching...
No Matches
llfio_v2_xxx::error_info Struct Reference

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

#include "status_code.hpp"

Public Member Functions

 error_info ()=default
 Default constructor.
 
 error_info (std::error_code _ec)
 
 OUTCOME_TEMPLATE (class ErrorCondEnum) OUTCOME_TREQUIRES(OUTCOME_TPRED(std
 Implicit construct from an error condition enum.
 
int value () const noexcept
 Retrieve the value of the error code.
 
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
 
void throw_exception () const
 

Friends

std::error_code make_error_code (error_info ei)
 

Detailed Description

The cause of the failure of an operation in LLFIO.

Constructor & Destructor Documentation

◆ error_info()

llfio_v2_xxx::error_info::error_info ( std::error_code  _ec)
inlineexplicit
649 : ec(_ec)
650{
651// Here is a VERY useful place to breakpoint!
652#ifndef LLFIO_DISABLE_PATHS_IN_FAILURE_INFO
653 if(ec)
654 {
655 detail::fill_failure_info(*this, this->ec);
656 }
657#endif
658}

Member Function Documentation

◆ message()

std::string llfio_v2_xxx::error_info::message ( ) const
inline

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.

500 {
501 std::string ret(ec.message());
502#if !LLFIO_DISABLE_PATHS_IN_FAILURE_INFO
503 detail::append_path_info(*this, ret);
504#endif
505 return ret;
506 }

◆ OUTCOME_TEMPLATE()

llfio_v2_xxx::error_info::OUTCOME_TEMPLATE ( class ErrorCondEnum  )
inline

Implicit construct from an error condition enum.

459 : error_info(make_error_code(std::forward<ErrorCondEnum>(v)))
460 {
461 }
error_info()=default
Default constructor.

◆ path1()

filesystem::path llfio_v2_xxx::error_info::path1 ( ) const
inline

Retrieve any first path associated with this failure. Note this only works if called from the same thread as where the failure occurred.

467 {
468#if !LLFIO_DISABLE_PATHS_IN_FAILURE_INFO
469 if(QUICKCPPLIB_NAMESPACE::utils::thread::this_thread_id() == _thread_id)
470 {
471 auto &tls = detail::tls_errored_results();
472 const char *path1 = tls.get(_tls_path_id1);
473 if(path1 != nullptr)
474 {
475 return filesystem::path(path1);
476 }
477 }
478#endif
479 return {};
480 }
filesystem::path path1() const
Retrieve any first path associated with this failure. Note this only works if called from the same th...
Definition status_code.hpp:466

◆ path2()

filesystem::path llfio_v2_xxx::error_info::path2 ( ) const
inline

Retrieve any second path associated with this failure. Note this only works if called from the same thread as where the failure occurred.

483 {
484#if !LLFIO_DISABLE_PATHS_IN_FAILURE_INFO
485 if(QUICKCPPLIB_NAMESPACE::utils::thread::this_thread_id() == _thread_id)
486 {
487 auto &tls = detail::tls_errored_results();
488 const char *path2 = tls.get(_tls_path_id2);
489 if(path2 != nullptr)
490 {
491 return filesystem::path(path2);
492 }
493 }
494#endif
495 return {};
496 }
filesystem::path path2() const
Retrieve any second path associated with this failure. Note this only works if called from the same t...
Definition status_code.hpp:482

◆ throw_exception()

void llfio_v2_xxx::error_info::throw_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.

613{
614 std::string msg;
615 LLFIO_EXCEPTION_TRY
616 {
617 msg = message();
618 }
619 LLFIO_EXCEPTION_CATCH_ALL {}
620#ifdef __cpp_exceptions
621 OUTCOME_V2_NAMESPACE::try_throw_std_exception_from_error(ec, msg);
622#endif
623 LLFIO_EXCEPTION_THROW(error(*this));
624}
std::string message() const
Definition status_code.hpp:499

◆ value()

int llfio_v2_xxx::error_info::value ( ) const
inlinenoexcept

Retrieve the value of the error code.

464{ return ec.value(); }

Friends And Related Symbol Documentation

◆ make_error_code

std::error_code make_error_code ( error_info  ei)
friend
587{
588 return ei.ec;
589}

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