pdf.GetLastError on MorphOS

Discuss PDF file handling with the Polybios plugin here
Post Reply
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

pdf.GetLastError on MorphOS

Post by jPV »

pdf.GetLastError state doesn't seem to reset on MorphOS... if you had a fail, but then open successfully, pdf.GetLastError still shows a fail.

Code: Select all

@REQUIRE "polybios", {Version=1, Revision=1}
; Trying to open a non-existent pdf:
ExitOnError(False)
pdf.OpenDocument(1, "PDFReference.pdf.notfound")
ExitOnError(True)
t=pdf.GetLastError()
DebugPrint(t)
; Open an existing pdf:
ExitOnError(False)
pdf.OpenDocument(1, "PDFReference.pdf")
ExitOnError(True)
t=pdf.GetLastError()
DebugPrint(t) 
On MorphOS you get:
2
2

While on Windows you get:
2
0
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: pdf.GetLastError on MorphOS

Post by airsoftsoftwair »

Hmm, well, actually the behaviour on MorphOS is the one that should be the normal one. You must only call pdf.GetLastError() if pdf.OpenDocument() actually failed so I'll have to examine why the error state is reset on Windows because that normally shouldn't happen, although it might be quite common sensical to do so...
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: pdf.GetLastError on MorphOS

Post by jPV »

airsoftsoftwair wrote: Sun Jul 14, 2019 6:01 pm You must only call pdf.GetLastError() if pdf.OpenDocument() actually failed
Why there is #PDFERR_SUCCESS (No error occurred.) then?
Tipsi
Posts: 21
Joined: Sun Feb 14, 2010 6:06 pm
Location: Switzerland

Re: pdf.GetLastError on MorphOS

Post by Tipsi »

Hi jpv

What if you write pdf.GetLastError() immediately after pdf.OpenDocument()?

Code: Select all

ExitOnError(False)
pdf.OpenDocument(1, "PDFReference.pdf.notfound")
t=pdf.GetLastError()
ExitOnError(True)
DebugPrint(t)
Griessli
Tipsi
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: pdf.GetLastError on MorphOS

Post by jPV »

Tipsi wrote: Mon Jul 15, 2019 10:23 pm What if you write pdf.GetLastError() immediately after pdf.OpenDocument()?
Didn't make any difference.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: pdf.GetLastError on MorphOS

Post by airsoftsoftwair »

Okay, I've adapted this now to be more consistent. pdf.GetLastError() will return 0 on success now.

Code: Select all

- Fix: pdf.GetLastError() will now return #PDFERR_SUCCESS (0) in case pdf.OpenDocument() succeeded
Post Reply