OpenCV  5.0.0-pre
Open Source Computer Vision
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members

Class passed to an error. More...

#include <opencv2/core/exception.hpp>

Collaboration diagram for cv::Exception:

Public Member Functions

 Exception ()
 
 Exception (Error::Code _code, const std::string &_err, const std::string &_func, const std::string &_file, int _line)
 
virtual ~Exception () CV_NOEXCEPT
 
const char * codeMessage () const
 
void formatMessage ()
 
virtual const char * what () const CV_NOEXCEPT CV_OVERRIDE
 

Public Attributes

Error::Code code
 error code
 
std::string err
 error description
 
std::string file
 source file name where the error has occurred
 
std::string func
 function name. Available only when the compiler supports getting it
 
int line
 line number in the source file where the error has occurred
 
std::string msg
 the formatted error message
 

Detailed Description

Class passed to an error.

This class encapsulates all or almost all necessary information about the error happened in the program. The exception is usually constructed and thrown implicitly via CV_Error and CV_Error_ macros.

See also
error
Examples
samples/cpp/pca.cpp, samples/cpp/snippets/detect_blob.cpp, and samples/hog_tapi.cpp.

Constructor & Destructor Documentation

◆ Exception() [1/2]

cv::Exception::Exception ( )

Default constructor

◆ Exception() [2/2]

cv::Exception::Exception ( Error::Code  _code,
const std::string &  _err,
const std::string &  _func,
const std::string &  _file,
int  _line 
)

Full constructor. Normally the constructor is not called explicitly. Instead, the macros CV_Error(), CV_Error_() and CV_Assert() are used.

◆ ~Exception()

virtual cv::Exception::~Exception ( )
virtual

Member Function Documentation

◆ codeMessage()

const char * cv::Exception::codeMessage ( ) const

◆ formatMessage()

void cv::Exception::formatMessage ( )

◆ what()

virtual const char * cv::Exception::what ( ) const
virtual
Returns
the error description and the context as a text string.
Examples
samples/hog_tapi.cpp.

Member Data Documentation

◆ code

Error::Code cv::Exception::code

error code

See also
CVStatus

◆ err

std::string cv::Exception::err

error description

◆ file

std::string cv::Exception::file

source file name where the error has occurred

◆ func

std::string cv::Exception::func

function name. Available only when the compiler supports getting it

◆ line

int cv::Exception::line

line number in the source file where the error has occurred

◆ msg

std::string cv::Exception::msg

the formatted error message

Examples
samples/cpp/pca.cpp, and samples/cpp/snippets/detect_blob.cpp.

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