python: also catch general c++ exceptions#19440
Conversation
alalek
left a comment
There was a problem hiding this comment.
Thank you for contribution!
Please rebase patch on 3.4 branch.
|
@paroj thank you for contribution! Can you add a simple test for added scenario? It can be done as an additional method in the CV_WRAP static inline
void testRaiseGeneralException()
{
throw std::exception("exception text");
}and catch raised exception in Python using the following pattern: with self.assertRaises((cv.error,),
msg='C++ exception is not propagated to Python in the right way') as cm:
cv.utils.testRaiseGeneralException()
self.assertEqual(cm.exception.message, 'exception text')Apart from that, maybe |
1f5dc0f to
bf88fb9
Compare
|
@VadimLevin copy pasted the tests as desired. Are you aware that you can push to my PRs if you have maintainer access?
we would not be able to report anything useful in this case. Also |
|
8413680 to
1b6f2e2
Compare
they might be thrown from third-party code (notably Ogre in the ovis module). While Linux is kind enough to print them, they cause instant termination on Windows. Arguably, they do not origin from OpenCV itself, but still this helps understanding what went wrong when calling an OpenCV function.
they might be thrown from third-party code (notably Ogre in the ovis
module).
While Linux is kind enough to print them, they cause instant termination
on Windows.
Arguably, they do not origin from OpenCV itself, but still this helps
understanding what went wrong when calling an OpenCV function.
@andy-held
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.