WPILibC++  2020.3.2-60-g3011ebe
wpi::ExitOnError Class Reference

Helper for check-and-exit error handling. More...

#include <Error.h>

Public Member Functions

 ExitOnError (std::string Banner="", int DefaultErrorExitCode=1)
 Create an error on exit helper.
 
void setBanner (std::string Banner)
 Set the banner string for any errors caught by operator().
 
void setExitCodeMapper (std::function< int(const Error &)> GetExitCode)
 Set the exit-code mapper function.
 
void operator() (Error Err) const
 Check Err. If it's in a failure state log the error(s) and exit.
 
template<typename T >
operator() (Expected< T > &&E) const
 Check E. More...
 
template<typename T >
T & operator() (Expected< T & > &&E) const
 Check E. More...
 

Detailed Description

Helper for check-and-exit error handling.

For tool use only. NOT FOR USE IN LIBRARY CODE.

Member Function Documentation

◆ operator()() [1/2]

template<typename T >
T& wpi::ExitOnError::operator() ( Expected< T & > &&  E) const
inline

Check E.

If it's in a success state then return the contained reference. If it's in a failure state log the error(s) and exit.

◆ operator()() [2/2]

template<typename T >
T wpi::ExitOnError::operator() ( Expected< T > &&  E) const
inline

Check E.

If it's in a success state then return the contained value. If it's in a failure state log the error(s) and exit.


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