Syntax errors / Exception handling with COM+ interface
Posted: 2009-10-02T09:33:26-07:00
Hello,
I'm trying to integrate the ImageMagickObject COM+ interface with a test app written in Delphi.
Everything works wonders, but I can't seem to find a way to properly handle exceptions and syntax errors.
Let's say in a similar VB sample I call
no image is output on disk, which is normal since there is a syntax error in the "15a0x151" parameter.
However, I can't seem to find a way to do proper exception/error handling for such a case When something really goes wrong with COM+, then Err.Number is updated (or an Exception is thrown in Delphi), but if there is a syntax error or a missing param or something in the actual IM commandline, the call just silently fails without throwing any exceptions/errors.
The only thing I've found is to output the width of the result image and then check if msgs is > 0, then I can assume my convert succeeded.
Also, calling retrieving the "Messages" property of the COM interface results in "Not Implemented" message ...
Is there a clean way to do proper exception handling with the COM interface like with other programmatic interfaces (like retrieving error codes and so on http://www.imagemagick.org/script/exception.php)
Thanks !
I'm trying to integrate the ImageMagickObject COM+ interface with a test app written in Delphi.
Everything works wonders, but I can't seem to find a way to properly handle exceptions and syntax errors.
Let's say in a similar VB sample I call
Code: Select all
msgs = img.Convert("logo:","-resize","15a0x151","-format","%w","PNG24:logo.png")
However, I can't seem to find a way to do proper exception/error handling for such a case When something really goes wrong with COM+, then Err.Number is updated (or an Exception is thrown in Delphi), but if there is a syntax error or a missing param or something in the actual IM commandline, the call just silently fails without throwing any exceptions/errors.
The only thing I've found is to output the width of the result image and then check if msgs is > 0, then I can assume my convert succeeded.
Also, calling retrieving the "Messages" property of the COM interface results in "Not Implemented" message ...
Is there a clean way to do proper exception handling with the COM interface like with other programmatic interfaces (like retrieving error codes and so on http://www.imagemagick.org/script/exception.php)
Thanks !