Page 1 of 1

libWand and Exception Handling

Posted: 2006-10-01T14:35:44-07:00
by oliver.andrich
Hi,

is there a rule of thumb when to check for exceptions, when using libWand? Everytime a Boolean is returned? Or is there any documentation available, that clearly states when to check?

Best regards,
Oliver Andrich

Posted: 2006-10-01T16:10:14-07:00
by magick
In most cases you check for an exception when a method returns MagickFalse which indicates the method failed. The exception will tell you why the method failed.

Posted: 2006-10-01T16:36:16-07:00
by oliver.andrich
magick wrote: In most cases you check for an exception when a method returns MagickFalse which indicates the method failed. The exception will tell you why the method failed.


Okay, this is good to now.

And another question if have still on my mind. Is it absolutely essential to call MagickWandGenesis and MagickWandTerminus? I ask, cause I have code that is working without it.

Best regards,
Oliver

Posted: 2006-10-01T17:03:44-07:00
by magick
MagickWandGenesis() and MagickWandTerminus() are optional. The API will automatically initialize its environment (i.e. MagickWandGenesis()), however, it will not automatically free all resources when you are finished with the API unless you call MagickWandTerminus() or exit your program.