MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
mxl::lib::fabrics::ofi::Exception Class Reference

Custom exception type used in the fabrics library. More...

#include <Exception.hpp>

Inheritance diagram for mxl::lib::fabrics::ofi::Exception:
Collaboration diagram for mxl::lib::fabrics::ofi::Exception:

Public Member Functions

 Exception (std::string msg, mxlStatus status)
mxlStatus status () const noexcept
 Return the mxlStatus status code that describes the condition that led to the exception being thrown.
char const * what () const noexcept override
 Implements std::exception, returns a descriptive string about the error.

Static Public Member Functions

template<typename... T>
static Exception exists (fmt::format_string< T... > fmt, T &&... args)
 Make an MXL_ERR_EXISTS exception.
template<typename... T>
static Exception internal (fmt::format_string< T... > fmt, T &&... args)
 Make an MXL_ERR_INTERNAL exception.
template<typename... T>
static Exception interrupted (fmt::format_string< T... > fmt, T &&... args)
 Make an MXL_ERR_INTERRUPTED exception.
template<typename... T>
static Exception invalidArgument (fmt::format_string< T... > fmt, T &&... args)
 Make an MXL_ERR_INVALID_ARG exception.
template<typename... T>
static Exception invalidState (fmt::format_string< T... > fmt, T &&... args)
 Make an MXL_ERR_INVALID_STATE exception.
template<typename... T>
static Exception make (mxlStatus status, fmt::format_string< T... > fmt, T &&... args)
 Make any type of exception.
template<typename... T>
static Exception noFabric (fmt::format_string< T... > fmt, T &&... args)
template<typename... T>
static Exception notFound (fmt::format_string< T... > fmt, T &&... args)
 Make an MXL_ERR_NOT_FOUND exception.
template<typename... T>
static Exception unsupportedOperation (fmt::format_string< T... > fmt, T &&... args)

Private Attributes

std::string _msg
mxlStatus _status

Detailed Description

Custom exception type used in the fabrics library.

Used to propagate information about error conditions to the api surface by carrying a status code.

Definition at line 27 of file Exception.hpp.

Constructor & Destructor Documentation

◆ Exception()

mxl::lib::fabrics::ofi::Exception::Exception ( std::string msg,
mxlStatus status )

Definition at line 11 of file Exception.cpp.

12 : _msg(std::move(msg))
14 {}
mxlStatus status() const noexcept
Return the mxlStatus status code that describes the condition that led to the exception being thrown.
Definition Exception.cpp:16

Member Function Documentation

◆ exists()

template<typename... T>
Exception mxl::lib::fabrics::ofi::Exception::exists ( fmt::format_string< T... > fmt,
T &&... args )
inlinestatic

Make an MXL_ERR_EXISTS exception.

Definition at line 67 of file Exception.hpp.

68 {
69 return make(MXL_ERR_EXISTS, fmt, std::forward<T>(args)...);
70 }
static Exception make(mxlStatus status, fmt::format_string< T... > fmt, T &&... args)
Make any type of exception.
Definition Exception.hpp:35
@ MXL_ERR_EXISTS
Definition mxl.h:51

◆ internal()

template<typename... T>
Exception mxl::lib::fabrics::ofi::Exception::internal ( fmt::format_string< T... > fmt,
T &&... args )
inlinestatic

Make an MXL_ERR_INTERNAL exception.

Definition at line 51 of file Exception.hpp.

52 {
53 return make(MXL_ERR_INTERNAL, fmt, std::forward<T>(args)...);
54 }
@ MXL_ERR_INTERNAL
Definition mxl.h:48

◆ interrupted()

template<typename... T>
Exception mxl::lib::fabrics::ofi::Exception::interrupted ( fmt::format_string< T... > fmt,
T &&... args )
inlinestatic

Make an MXL_ERR_INTERRUPTED exception.

Definition at line 83 of file Exception.hpp.

84 {
85 return make(MXL_ERR_INTERRUPTED, fmt, std::forward<T>(args)...);
86 }
@ MXL_ERR_INTERRUPTED
Definition mxl.h:45

◆ invalidArgument()

template<typename... T>
Exception mxl::lib::fabrics::ofi::Exception::invalidArgument ( fmt::format_string< T... > fmt,
T &&... args )
inlinestatic

Make an MXL_ERR_INVALID_ARG exception.

Definition at line 43 of file Exception.hpp.

44 {
45 return make(MXL_ERR_INVALID_ARG, fmt, std::forward<T>(args)...);
46 }
@ MXL_ERR_INVALID_ARG
Definition mxl.h:35

◆ invalidState()

template<typename... T>
Exception mxl::lib::fabrics::ofi::Exception::invalidState ( fmt::format_string< T... > fmt,
T &&... args )
inlinestatic

Make an MXL_ERR_INVALID_STATE exception.

Definition at line 59 of file Exception.hpp.

60 {
61 return make(MXL_ERR_INVALID_STATE, fmt, std::forward<T>(args)...);
62 }
@ MXL_ERR_INVALID_STATE
Definition mxl.h:47

◆ make()

template<typename... T>
Exception mxl::lib::fabrics::ofi::Exception::make ( mxlStatus status,
fmt::format_string< T... > fmt,
T &&... args )
inlinestatic

Make any type of exception.

Definition at line 35 of file Exception.hpp.

36 {
37 return Exception(fmt::format(fmt, std::forward<T>(args)...), status);
38 }
Exception(std::string msg, mxlStatus status)
Definition Exception.cpp:11

◆ noFabric()

template<typename... T>
Exception mxl::lib::fabrics::ofi::Exception::noFabric ( fmt::format_string< T... > fmt,
T &&... args )
inlinestatic

Definition at line 95 of file Exception.hpp.

96 {
97 return make(MXL_ERR_NO_FABRIC, fmt, std::forward<T>(args)...);
98 }
@ MXL_ERR_NO_FABRIC
Definition mxl.h:46

◆ notFound()

template<typename... T>
Exception mxl::lib::fabrics::ofi::Exception::notFound ( fmt::format_string< T... > fmt,
T &&... args )
inlinestatic

Make an MXL_ERR_NOT_FOUND exception.

Definition at line 75 of file Exception.hpp.

76 {
77 return make(MXL_ERR_NOT_FOUND, fmt, std::forward<T>(args)...);
78 }
@ MXL_ERR_NOT_FOUND
Definition mxl.h:50

◆ status()

mxlStatus mxl::lib::fabrics::ofi::Exception::status ( ) const
nodiscardnoexcept

Return the mxlStatus status code that describes the condition that led to the exception being thrown.

Definition at line 16 of file Exception.cpp.

17 {
18 return _status;
19 }

◆ unsupportedOperation()

template<typename... T>
Exception mxl::lib::fabrics::ofi::Exception::unsupportedOperation ( fmt::format_string< T... > fmt,
T &&... args )
inlinestatic

Definition at line 89 of file Exception.hpp.

90 {
91 return make(MXL_ERR_UNSUPPORTED_OPERATION, fmt, std::forward<T>(args)...);
92 }
@ MXL_ERR_UNSUPPORTED_OPERATION
Definition mxl.h:52

◆ what()

char const * mxl::lib::fabrics::ofi::Exception::what ( ) const
nodiscardoverridenoexcept

Implements std::exception, returns a descriptive string about the error.

Definition at line 21 of file Exception.cpp.

22 {
23 return _msg.c_str();
24 }

Member Data Documentation

◆ _msg

std::string mxl::lib::fabrics::ofi::Exception::_msg
private

Definition at line 112 of file Exception.hpp.

◆ _status

mxlStatus mxl::lib::fabrics::ofi::Exception::_status
private

Definition at line 113 of file Exception.hpp.


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