# Try -catch failure

**URL:** <https://forum.opencv.org/t/try-catch-failure/5886>\
**Category:** Uncategorized\
**Created:** [October 27, 2021, 11:57am UTC](https://forum.opencv.org/t/try-catch-failure/5886 "2021-10-27T11:57:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![16631a0413](https://avatars.discourse-cdn.com/v4/letter/1/bc8723/32.png) [@16631a0413](https://forum.opencv.org/u/16631a0413)\
**Post date:** [October 27, 2021, 11:57am UTC](https://forum.opencv.org/t/try-catch-failure/5886/1 "2021-10-27T11:57:11Z")

</div>

#include \<opencv2/highgui.hpp\>  
#include \<opencv2/imgcodecs.hpp\>  
#include \<opencv2/imgproc.hpp\>  
#include \<opencv2/objdetect.hpp\>  
#include \<opencv2/barcode.hpp\>  
#include \<opencv2/videoio.hpp\>  
#include   
#include   
#include   
#include   
#include  
/\*  
Function : start  
Accepts : Agv\*  
Returns : int  
Abstraction : Take Agv\* as argumnent and performs vision application  
Modified by : 23-10-21 - Srikanth  
\*/  
int main() {

std::string videoStreamAddress = /192.168.1.2:4747/video";  
cv::VideoCapture cap( videoStreamAddress );

try{  
cap.isOpened();  
}  
catch(cv::Exception& e)  
{  
// const char\* err\_msg = e.what();  
std::cout \<\< "exception caught: " \<\< e.msg \<\< std::endl;  
}  
return 0;  
}  
this code not able catch exception.

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [October 27, 2021, 12:33pm UTC](https://forum.opencv.org/t/try-catch-failure/5886/2 "2021-10-27T12:33:02Z")

</div>

I am pretty sure `cap.isOpened()` doesn’t throw exceptions. I am not even sure the `cv::VideoCapture` constructor does. When you run in debug what are the exception details printed to the cmd window/terminal?
