Page 1 of 1

pdf.GetLastError on MorphOS

Posted: Sat Jul 13, 2019 11:55 am
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

Re: pdf.GetLastError on MorphOS

Posted: Sun Jul 14, 2019 6:01 pm
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...

Re: pdf.GetLastError on MorphOS

Posted: Mon Jul 15, 2019 8:28 am
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?

Re: pdf.GetLastError on MorphOS

Posted: Mon Jul 15, 2019 10:23 pm
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

Re: pdf.GetLastError on MorphOS

Posted: Tue Jul 16, 2019 11:36 am
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.

Re: pdf.GetLastError on MorphOS

Posted: Thu Jul 18, 2019 10:48 pm
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