Doubt Related to MagickWand

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Locked
ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Doubt Related to MagickWand

Post by ArunKumar »

How to handle the Exception for these MagickWand methods and What are the possible Exception for these Methods

1.)MagickWandGenesis()
2.)NewMagickWand()
3.)DestroyMagickWand()
4.)MagickWandTerminus()
5.)MagickReadImage()
6.)MagickResizeImage()
7.)MagickWriteImage()

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Doubt Related to MagickWand

Post by snibgo »

In my opinion: you should always trap exceptions.

If MagickWandGenesis() or MagickWandTerminus() fails, the program probably can't do much else so should report the error and fail (gracefully). The other functions might fail because memory can't be allocated, or an input file can't be found, or whatever. For some failures in some programs, a fall-back operation may be reasonable.

The exceptions that can be raised by each function can be found by reading the source code.
snibgo's IM pages: im.snibgo.com

ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Re: Doubt Related to MagickWand

Post by ArunKumar »

I got Exception using MagickGetException() method Which is caused during the run time

But How to handle these Exception. Becuase it interrupts the normal flow of the program.

Any way to Handle this ?

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Doubt Related to MagickWand

Post by snibgo »

See exception.c and exception.h
snibgo's IM pages: im.snibgo.com

ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Re: Doubt Related to MagickWand

Post by ArunKumar »

snibgo wrote:
2020-04-02T06:24:43-07:00
See exception.c and exception.h
But This is Related to MagickCore i.e exception.c and exception.h is coming under MagickCore
How Can I use this ?.
I'm using MagickWand Methods in my program.

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Doubt Related to MagickWand

Post by snibgo »

See also the exception functions in magick-wand.c. These use exception.c functions. For example, you could take different actions depending on severity.
snibgo's IM pages: im.snibgo.com

ArunKumar
Posts: 59
Joined: 2020-03-05T00:12:15-07:00
Authentication code: 1152

Re: Doubt Related to MagickWand

Post by ArunKumar »

1.)If any method give MagickFalse as a Status I used MagickGetException() & MagickClearException() to handle the run time error .

2.)Even though I used MagickGetException() & MagickClearException() to handle the run time error . But SomeTime error occur & program stopped due to that error

3.)What to do in that case ?

Locked