OpenCV 4.11.0-pre
Open Source Computer Vision
Loading...
Searching...
No Matches

Class passed to an error. More...

#include <opencv2/core.hpp>

Collaboration diagram for cv::Exception:

Public Member Functions

 Exception ()
 
 Exception (int _code, const String &_err, const String &_func, const String &_file, int _line)
 
virtual ~Exception () noexcept
 
void formatMessage ()
 
virtual const char * what () const noexcept override
 

Public Attributes

int code
 error code
 
String err
 error description
 
String file
 source file name where the error has occurred
 
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
 
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, and samples/tapi/hog.cpp.

Constructor & Destructor Documentation

◆ Exception() [1/2]

cv::Exception::Exception ( )

Default constructor

◆ Exception() [2/2]

cv::Exception::Exception ( int _code,
const String & _err,
const String & _func,
const 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 ( )
virtualnoexcept

Member Function Documentation

◆ formatMessage()

void cv::Exception::formatMessage ( )

◆ what()

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

Member Data Documentation

◆ code

int cv::Exception::code

error code

See also
CVStatus

◆ err

String cv::Exception::err

error description

◆ file

String cv::Exception::file

source file name where the error has occurred

◆ func

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

String cv::Exception::msg

the formatted error message

Examples
samples/cpp/pca.cpp.

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