CV icon indicating copy to clipboard operation
CV copied to clipboard

CvException from haskell callback cannot be catched.

Open onixie opened this issue 8 years ago • 0 comments

suppose we have a piece of code like below,

test = do
  setCatch
  image <- readFromFile "smallLena.jpg" :: IO (Image GrayScale D32)
  saveImage "poks.ok" image `catch`
         (\e -> do let err = show (e :: CvException)
                   print "catched"
                   return ())
  print "safe landed"
  return ()

saveImage throws an CvException because of bad file extension, but neither "catched" nor "safe landed" are printed out.

I think the problem originates from setCatch :: IO() which will call a throw in haskell callback when opencv errors happen. GLFW-b also had a similar problem before.

onixie avatar Oct 20 '16 13:10 onixie