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
 
filesystem::path path2 () const
 
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
656 : ec(_ec)
657{
658// Here is a VERY useful place to breakpoint!
659#ifndef LLFIO_DISABLE_PATHS_IN_FAILURE_INFO
660 if(ec)
661 {
662 detail::fill_failure_info(*this, this->ec);
663 }
664#endif
665}

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.

538 {
539 std::string ret(ec.message());
540#if !LLFIO_DISABLE_PATHS_IN_FAILURE_INFO
541 detail::append_path_info(*this, ret);
542#endif
543 return ret;
544 }

◆ OUTCOME_TEMPLATE()

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

Implicit construct from an error condition enum.

495 : error_info(make_error_code(std::forward<ErrorCondEnum>(v)))
496 {
497 }
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.

504 {
505#if !LLFIO_DISABLE_PATHS_IN_FAILURE_INFO
506 if(QUICKCPPLIB_NAMESPACE::utils::thread::this_thread_id() == _thread_id)
507 {
508 auto &tls = detail::tls_errored_results();
509 const char *path1 = tls.get(_tls_path_id1);
510 if(path1 != nullptr)
511 {
512 return filesystem::path(path1);
513 }
514 }
515#endif
516 return {};
517 }
filesystem::path path1() const
Definition status_code.hpp:503

◆ 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.

521 {
522#if !LLFIO_DISABLE_PATHS_IN_FAILURE_INFO
523 if(QUICKCPPLIB_NAMESPACE::utils::thread::this_thread_id() == _thread_id)
524 {
525 auto &tls = detail::tls_errored_results();
526 const char *path2 = tls.get(_tls_path_id2);
527 if(path2 != nullptr)
528 {
529 return filesystem::path(path2);
530 }
531 }
532#endif
533 return {};
534 }
filesystem::path path2() const
Definition status_code.hpp:520

◆ 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.

655{
656 std::string msg;
657 LLFIO_EXCEPTION_TRY
658 {
659 msg = message();
660 }
661 LLFIO_EXCEPTION_CATCH_ALL {}
662#ifdef __cpp_exceptions
663 OUTCOME_V2_NAMESPACE::try_throw_std_exception_from_error(ec, msg);
664#endif
665 LLFIO_EXCEPTION_THROW(error(*this));
666}
std::string message() const
Definition status_code.hpp:537

◆ value()

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

Retrieve the value of the error code.

500{ return ec.value(); }

Friends And Related Symbol Documentation

◆ make_error_code

std::error_code make_error_code ( error_info  ei)
friend
629{
630 return ei.ec;
631}

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