Electroneum
Loading...
Searching...
No Matches
detail::expect Struct Reference

#include <expect.h>

Static Public Member Functions

static void throw_ (std::error_code ec, const char *msg, const char *file, unsigned line)
template<typename T>
static T unwrap (::expect< T > &&result, const char *error_msg, const char *file, unsigned line)
 If result.has_error() call throw_. Otherwise,.
static void unwrap (::expect< void > &&result, const char *error_msg, const char *file, unsigned line)
 If result.has_error() call throw_.

Detailed Description

Definition at line 78 of file expect.h.

Member Function Documentation

◆ throw_()

void expect< T >::throw_ ( std::error_code ec,
const char * msg,
const char * file,
unsigned line )
static
Exceptions
std::system_errorwith ec, optional msg and/or optional file + line.

Definition at line 64 of file expect.cpp.

65 {
66 if (msg || file)
67 throw std::system_error{ec, generate_error(msg, file, line)};
68 throw std::system_error{ec};
69 }
Here is the caller graph for this function:

◆ unwrap() [1/2]

template<typename T>
T detail::expect::unwrap ( ::expect< T > && result,
const char * error_msg,
const char * file,
unsigned line )
inlinestatic

If result.has_error() call throw_. Otherwise,.

Returns
*result by move.

Definition at line 85 of file expect.h.

86 {
87 if (!result)
88 throw_(result.error(), error_msg, file, line);
89 return std::move(*result);
90 }
*return False if otherwise error()
static void throw_(std::error_code ec, const char *msg, const char *file, unsigned line)
Definition expect.cpp:64
Here is the call graph for this function:

◆ unwrap() [2/2]

void expect< T >::unwrap ( ::expect< void > && result,
const char * error_msg,
const char * file,
unsigned line )
inlinestatic

If result.has_error() call throw_.

Definition at line 443 of file expect.h.

444 {
445 if (!result)
446 throw_(result.error(), error_msg, file, line);
447 }
*return Error alway std::error_code error() const noexcept
Definition expect.h:375
Here is the call graph for this function:

The documentation for this struct was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/common/expect.h
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/src/common/expect.cpp