mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
Internal Error Reporting

These functions are meant to be used by mxlib itself. You should use the non-internal versions, which don't start with mxlib_, in most other cases.

Namespaces

namespace  mx::internal
 Namespace for the internal error reporting functions.
 

Macros

#define mxlib_error_check(fxn)
 Perform an error check, if an error occurs report it and return the error. Does not return on no error.
 
#define mxlib_error_return(fxn)
 Perform an error check, if an error occurs report it, and return the error code even if no error.
 

Functions

template<class verboseT = verbose::d>
std::string mx::internal::mxlib_error_message (const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
 Format a report given an mxlib error_t code and explanation.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::o > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::o.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::v > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::v.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vv > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::vv.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vvv > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::vvv.
 
template<class verboseT = verbose::d>
std::string mx::internal::mxlib_error_message (const error_t &code, const std::source_location &loc=std::source_location::current())
 Format a report given an mxlib error_t code.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::o > (const error_t &code, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::o.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::v > (const error_t &code, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::v.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vv > (const error_t &code, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::vv.
 
template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vvv > (const error_t &code, const std::source_location &loc)
 Specialization of mxlib_error_message for verbose::vvv.
 
template<class verboseT = verbose::d>
error_t mx::internal::mxlib_error_report (const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
 Print a report to stderr given an mxlib error_t code and explanation and return the code.
 
template<>
error_t mx::internal::mxlib_error_report< mx::verbose::o > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of mxlib_error_report for verbose::o.
 
template<class verboseT = verbose::d>
error_t mx::internal::mxlib_error_report (const error_t &code, const std::source_location &loc=std::source_location::current())
 Print a report to stderr given an mxlib error_t code and return the code.
 
template<>
error_t mx::internal::mxlib_error_report< mx::verbose::o > (const error_t &code, const std::source_location &loc)
 Specialization of mxlib_error_report for verbose::o.
 

Macro Definition Documentation

◆ mxlib_error_check

#define mxlib_error_check (   fxn)
Value:
{ \
mx::error_t __mxlib_error_check_errc = fxn; \
if( __mxlib_error_check_errc != mx::error_t::noerror ) \
{ \
return internal::mxlib_error_report<verboseT>( __mxlib_error_check_errc ); \
} \
}
error_t
The mxlib error codes.
Definition error_t.hpp:26
@ noerror
No error has occurred.

Perform an error check, if an error occurs report it and return the error. Does not return on no error.

Scope protected so the error_t value does not interfere with other values.

Note
this requires that the verbosity template parameter is verboseT
Parameters
fxnis the function to call and check the return value of

Definition at line 405 of file error.hpp.

◆ mxlib_error_return

#define mxlib_error_return (   fxn)
Value:
{ \
mx::error_t __mxlib_error_return_errc = fxn; \
if( __mxlib_error_return_errc != mx::error_t::noerror ) \
{ \
return internal::mxlib_error_report<verboseT>( __mxlib_error_return_errc ); \
} \
}

Perform an error check, if an error occurs report it, and return the error code even if no error.

Scope protected so the error_t value does not interfere with other values.

Note
this requires that the verbosity template parameter is verboseT
Parameters
fxnis the function to call and check the return value of

Definition at line 424 of file error.hpp.

Function Documentation

◆ mxlib_error_message() [1/2]

template<class verboseT = verbose::d>
std::string mx::internal::mxlib_error_message ( const error_t code,
const std::source_location &  loc = std::source_location::current() 
)

Format a report given an mxlib error_t code.

What is included depends on the verbosity level set by the template parameter This is for internal mxlib use, it includes mxlib in the vvv report.

Template Parameters
verboseTsets the verbosity level based on its level member.
Returns
the formatted message
Parameters
[in]codeis an mx::error_t error code
[in]loc[opt] source location

◆ mxlib_error_message() [2/2]

template<class verboseT = verbose::d>
std::string mx::internal::mxlib_error_message ( const error_t code,
const std::string &  expl,
const std::source_location &  loc = std::source_location::current() 
)

Format a report given an mxlib error_t code and explanation.

What is included depends on the verbosity level set by the template parameter This is for internal mxlib use, it includes mxlib in the vvv report.

Template Parameters
verboseTsets the verbosity level based on its level member.
Returns
the formatted message
Parameters
[in]codeis an mx::error_t error code
[in]expl[opt] if more information can be provided, use this to inform the user.
[in]loc[opt] source location

Referenced by unitTest::errorTest::errorTest::TEST_CASE().

◆ mxlib_error_message< mx::verbose::o >() [1/2]

template<>
std::string mx::internal::mxlib_error_message< mx::verbose::o > ( const error_t code,
const std::source_location &  loc 
)

Specialization of mxlib_error_message for verbose::o.

◆ mxlib_error_message< mx::verbose::o >() [2/2]

template<>
std::string mx::internal::mxlib_error_message< mx::verbose::o > ( const error_t code,
const std::string &  expl,
const std::source_location &  loc 
)

◆ mxlib_error_message< mx::verbose::v >() [1/2]

template<>
std::string mx::internal::mxlib_error_message< mx::verbose::v > ( const error_t code,
const std::source_location &  loc 
)

Specialization of mxlib_error_message for verbose::v.

◆ mxlib_error_message< mx::verbose::v >() [2/2]

template<>
std::string mx::internal::mxlib_error_message< mx::verbose::v > ( const error_t code,
const std::string &  expl,
const std::source_location &  loc 
)

◆ mxlib_error_message< mx::verbose::vv >() [1/2]

template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vv > ( const error_t code,
const std::source_location &  loc 
)

Specialization of mxlib_error_message for verbose::vv.

◆ mxlib_error_message< mx::verbose::vv >() [2/2]

template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vv > ( const error_t code,
const std::string &  expl,
const std::source_location &  loc 
)

◆ mxlib_error_message< mx::verbose::vvv >() [1/2]

template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vvv > ( const error_t code,
const std::source_location &  loc 
)

Specialization of mxlib_error_message for verbose::vvv.

◆ mxlib_error_message< mx::verbose::vvv >() [2/2]

template<>
std::string mx::internal::mxlib_error_message< mx::verbose::vvv > ( const error_t code,
const std::string &  expl,
const std::source_location &  loc 
)

◆ mxlib_error_report() [1/2]

template<class verboseT = verbose::d>
error_t mx::internal::mxlib_error_report ( const error_t code,
const std::source_location &  loc = std::source_location::current() 
)

Print a report to stderr given an mxlib error_t code and return the code.

What is printed depends on the verbosity level set by the template parameter This is for internal mxlib use, it includes mxlib in the vvv report.

Template Parameters
verboseTsets the verbosity level based on its level member.
Returns
the provided error_t code
Parameters
[in]codeis an mx::error_t error code
[in]loc[opt] source location

Definition at line 369 of file error.hpp.

References mx::noerror.

◆ mxlib_error_report() [2/2]

template<class verboseT = verbose::d>
error_t mx::internal::mxlib_error_report ( const error_t code,
const std::string &  expl,
const std::source_location &  loc = std::source_location::current() 
)

Print a report to stderr given an mxlib error_t code and explanation and return the code.

What is printed depends on the verbosity level set by the template parameter This is for internal mxlib use, it includes mxlib in the vvv report.

Template Parameters
verboseTsets the verbosity level based on its level member.
Returns
the provided error_t code
Parameters
[in]codeis an mx::error_t error code
[in]expl[opt] if more information can be provided, use this to inform the user.
[in]loc[opt] source location

Definition at line 331 of file error.hpp.

References mx::noerror.

Referenced by mx::AO::analysis::aoAtmosphere< _realT >::checkLayers(), mx::wfp::circularPupil(), mx::improc::cutPaddedImage(), mx::math::eigenSYEVR(), mx::sigproc::fourierModeCoordinates(), mx::sigproc::fourierModeNumber(), mx::sigproc::frequencyGrid(), mx::sys::gitRepo::getGitFileState(), mx::sys::gitRepo::getGitHash(), mx::sys::gitRepo::getGitModified(), mx::sys::gitRepo::getGitName(), mx::sigproc::makeFourierMode(), mx::sigproc::makeFourierModeFreqs_Circ(), mx::sigproc::makeFourierModeFreqs_PandV(), mx::sigproc::makeModifiedFourierMode(), mx::sigproc::noll_nm(), mx::improc::imageXCorrDiscrete< _ccImT >::operator()(), mx::AO::analysis::aoSystem< _realT, _inputSpectT, iosT >::optimumTauWFS(), mx::improc::imageXCorrFFT< _realImageT >::padFactor(), mx::improc::padImage(), mx::math::randomSeed(), mx::ioutils::readBinVector(), mx::app::appConfigurator::readConfig(), mx::improc::imageXCorrDiscrete< _ccImT >::refIm(), mx::improc::imageXCorrFFT< _realImageT >::refIm(), mx::improc::imageXCorrFFT< _realImageT >::resize(), mx::ipc::runCommand(), mx::math::fit::array2FitGaussian2D< realT >::setFixed(), mx::AO::analysis::fourierTemporalPSD< _realT, aosysT >::singleLayerPSD(), unitTest::errorTest::errorTest::TEST_CASE(), mx::ioutils::writeBinVector(), mx::sigproc::zernikeQNorm(), mx::sigproc::zernikeR(), and mx::sigproc::zernikeRCoeffs().

◆ mxlib_error_report< mx::verbose::o >() [1/2]

template<>
error_t mx::internal::mxlib_error_report< mx::verbose::o > ( const error_t code,
const std::source_location &  loc 
)

Specialization of mxlib_error_report for verbose::o.

◆ mxlib_error_report< mx::verbose::o >() [2/2]

template<>
error_t mx::internal::mxlib_error_report< mx::verbose::o > ( const error_t code,
const std::string &  expl,
const std::source_location &  loc 
)