Exception EFCreateError in EndDoc() not forwarded

  • Hi,

    if a document is created in memory (InMemoryMode = true) the pdf file is created if function EndDoc() is called.

    If the file can't be created the exception EFCreateError is thrown. But this exception is not forwarded and can't be catched by the user's code:

    Code
    try
    {   wPDF->EndDoc() ;
    }catch (Exception &ex)
    {
       // Bug: Exception handler is not called if exception EFCreateError occurs in EndDoc()!!!}

    On the other hand:

    If the document is not created in memory (InMemoryMode = false) the pdf file is created if function BeginDoc() is called.

    If the file can't be created the exception EFCreateError is thrown and forwarded as expected. It then can be catched by users code:

    Code
    try
    {
       wPDF->BeginDoc() ;
    }
    catch (Exception &ex)
    {
       // Ok: Exception handler is called if exception EFCreateError occurs in BeginDoc()!!!
    }

    This issue has been evaluated with wPDF V4.75.1 used by C++ Builder 10.3.1 Rio.

    In my opinion it is a bug. Maybe it will be fixed in the next release of wPDF!?

    Best regards

    Michael

  • Sorry for delayed answering, I was away some days...

    I'm not sure what you mean with "result value".

    As far as I could see in the available Delphi files (WPPDFWP.pas) are both BeginDoc() and EndDoc() declared as procedures. There is no result value!?

    We use wPDF with C++ Builder 10.3.1 Rio. The package was built from DX13 (but also the previous versions were affected).

    BeginDoc() works as expected: It throws the exception EFCreateError. I can catch it and handle its occurence.

    EndDoc() does NOT throw that exception. It is catched inside EndDoc() and not forwarded. I can't catch it.