Strange error when printing that I can't understand..

Xbase++ 2.0 Build 554 or later
Post Reply
Message
Author
User avatar
PedroAlex
Posts: 213
Joined: Tue Feb 09, 2010 3:06 am

Strange error when printing that I can't understand..

#1 Post by PedroAlex »

hello!

I have a problem in a POS system where I have an application that prints hundreds of receipts a day, but occasionally this error appears and the program interrupts.

here is the error:

------------------------------------------------------------------------------
Registo de Erro de "D:\User\AbRest\AbRest.exe" Data: 01/06/2022 18:47:57

Xbase++ versao : Xbase++ (R) Version 2.00.1176
Sistema Operativo : Windows 10 1809 Build 17763
------------------------------------------------------------------------------
oError:args :
-> VALTYPE: C VALUE: !
oError:canDefault : N
oError:canRetry : Y
oError:canSubstitute: N
oError:cargo : NIL
oError:description : Access to method not allowed in this context
oError:filename :
oError:genCode : 25
oError:operation : qqOut
oError:osCode : 0
oError:severity : 2
oError:subCode : 4402
oError:subSystem : BASE
oError:thread : 5
oError:tries : 14
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Chamado de TALAO_PEDIDO(373)
Chamado de IMPRIMIR_PEDIDOS_NOVOS(213)
Chamado de PROCESSAR_PEDIDOS(96)
Chamado de TRATA_PEDIDO(244)
Chamado de RECEBE_PEDIDO(65)
Chamado de ACTUALIZA_HORA_REST(45)
Chamado de (B)WTPOS(1403)


The Line 373 have this CODE :

Code: Select all

//---------------------------------------------------------------------------------
Function TALAO_PEDIDO( xPorta, xTipo, xSalto, aPedidos, nPrinter, xAnula, BDRate, cNomeOperador, cNomeSeccao, cNomeMesa )
//---------------------------------------------------------------------------------
Local oTalaoPrinter

set console off
set device to printer
set printer on

oTalaoPrinter := XbpPrinter():New():Create( Alltrim(Porta_Printer_Win),, )
Set printer to OBJECT oTalaoPrinter

? Chr(27)+chr(33)+chr(24)   //<<<<<<<<<-------------- Line 373

This code works well on hundreds of invoices made per day.
But unexpectedly 1 or 2 times a day this error occurs.
Does anyone have this kind of problem?
Pedro Alexandre

User avatar
rdonnay
Site Admin
Posts: 4559
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Strange error when printing that I can't understand..

#2 Post by rdonnay »

QQOut() is the function that is called when using the ?? <list> command in the source code.

It appears that your SET PRINTER command failed to establish the proper context for the output.
The eXpress train is coming - and it has more cars.

User avatar
PedroAlex
Posts: 213
Joined: Tue Feb 09, 2010 3:06 am

Re: Strange error when printing that I can't understand..

#3 Post by PedroAlex »

Hi Roger,

I appreciate your comment.
But what does this mean
" oError:description : Access to method not allowed in this context "


and do you know where I can find the explanation for this error? " BASE 4402 "

Thanks.
Pedro Alexandre

User avatar
rdonnay
Site Admin
Posts: 4559
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Strange error when printing that I can't understand..

#4 Post by rdonnay »

Make sure that the below code creates a proper printer object:

oTalaoPrinter := XbpPrinter():New():Create( Alltrim(Porta_Printer_Win),, )

Use the eXpress++ command WTF to view the object.

WTF oTalaoPrinter
The eXpress train is coming - and it has more cars.

User avatar
PedroAlex
Posts: 213
Joined: Tue Feb 09, 2010 3:06 am

Re: Strange error when printing that I can't understand..

#5 Post by PedroAlex »

Hi Roger,

I confirm that the object was created correctly.

I've spent many hours investigating and testing and I can't even get this error on my desktop.
This happens on the client and I know, because the system shows the error message and generates the error.log.
I have to find out what's going on!!

I will continue to investigate..

Thanks
Pedro Alexandre

User avatar
Tom
Posts: 1021
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Strange error when printing that I can't understand..

#6 Post by Tom »

Output using ? is not allowed if you have a GUI app and your device is the screen. You will get this error if you compile and link this app with the /PM:PM switch:

Code: Select all

FUNCTION Main()
MsgBox('Yo!') // this works
? 'Yo!' // this not
RETURN NIL

PROC APPSYS() ; RETURN
That means: Once in a while, the printer object can't be created. Maybe there is no default printer installed or available.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

skiman
Posts: 1050
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Strange error when printing that I can't understand..

#7 Post by skiman »

Hi,

I always check if the printername, your Alltrim(Porta_Printer_Win) is in the printer list. If the name is not exactly the same, it will not find the printer, and the object will not be created.
Best regards,

Chris.
www.aboservice.be

User avatar
Auge_Ohr
Posts: 1343
Joined: Wed Feb 24, 2010 3:44 pm

Re: Strange error when printing that I can't understand..

#8 Post by Auge_Ohr »

hi,
PedroAlex wrote: Mon Jun 13, 2022 11:05 am but occasionally this error appears and the program interrupts.
i wonder that you "think" that Printer is "always ready" ...

you did not "check" Status of Printer before send something to Output

1.) "check" if XbpPrinter Status is XBP_STAT_CREATE
2.) "check" if :printerStatus() is "ready" and "online"
greetings by OHR
Jimmy

User avatar
PedroAlex
Posts: 213
Joined: Tue Feb 09, 2010 3:06 am

Re: Strange error when printing that I can't understand..

#9 Post by PedroAlex »

Hello everybody!

Your messages were important to me because they helped me come up with new solutions to improve this routine.

Thank you all.
Pedro Alexandre

Post Reply