Win32::OLE and exceptions handling

Discussion in 'Perl Misc' started by RedAktor, Jul 30, 2003.

  1. RedAktor

    RedAktor Guest

    Hi,

    I've got one problem with it. I've try to use Error.pm and also set
    OLE->Warn param to sub i.e &HandleError. And it catches errors in both ways,
    but it doesn't pass OLE error number. In both ways Win32::OLE->LastError()
    returns 0. Is there another way to catch the error, get its number and
    gently handle it? I'm including ways I've tried to do this:

    1st
    --------------
    Win32::OLE->Option(Warn => &HandleError(Win32::OLE->LastError()));

    sub HandleError {
    $err = shift;
    if ($err == HRESULT(0x80020009)) {
    print "Error \n";
    exit;
    }
    }

    2nd
    -----------------------------
    try {
    $doc = $docs->Item($di);
    $err=Win32::OLE->LastError();
    throw Error::Simple $err;
    }
    catch Error with {
    my $E = shift;
    print $E;
    die;
    };

    --------------------------

    TIA
    Andrew
    Ps. Sorry for my English ;)
    RedAktor, Jul 30, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. M. David Allen

    Win32::OLE, Excel, and coloring

    M. David Allen, Jun 24, 2003, in forum: Perl
    Replies:
    1
    Views:
    5,386
    Jay Tilton
    Jun 25, 2003
  2. Patrick.O.Ige

    Ole ole

    Patrick.O.Ige, Jul 16, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    488
    Patrick.O.Ige
    Jul 16, 2006
  3. Drew Pihera
    Replies:
    0
    Views:
    637
    Drew Pihera
    Feb 4, 2004
  4. Nilez Parker

    Why can't I rescue OLE Exceptions?

    Nilez Parker, Apr 30, 2008, in forum: Ruby
    Replies:
    2
    Views:
    91
    Nilez Parker
    May 1, 2008
  5. Lance Hoffmeyer
    Replies:
    0
    Views:
    238
    Lance Hoffmeyer
    Nov 17, 2003
Loading...

Share This Page