OnErrorCall not working

All bugs related to new C backend
tored
User
User
Posts: 86
Joined: Wed Feb 16, 2022 12:47 pm
Location: Sweden

OnErrorCall not working

Post by tored »

Can't get OnErrorCall example in the manual to work with the C backend. However the OnErrorGoto example does work.

Code: Select all

  
  Procedure ErrorHandler()
    MessageRequester("OnError test", "The following error happened: " + ErrorMessage())
  EndProcedure

  MessageRequester("OnError test", "Test start")

  OnErrorCall(@ErrorHandler())
  Pokes(10, "Hello World") ; Cause a #PB_OnError_InvalidMemory error
  
  MessageRequester("OnError test", "This should never be displayed")

Make sure to create a separate executable to test it.

PureBasic 6.04 LTS (Windows - x64)
User avatar
ChrisR
Addict
Addict
Posts: 1466
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: OnErrorCall not working

Post by ChrisR »

The bug seems to be only with C Backend x64. It looks good with C Backend x86.
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

Re: OnErrorCall not working

Post by juergenkulow »

Code: Select all

; Again OnErrorGoto and OnErrorGosub on Windows 6.10 Beta 5 x64 C Backend do not work. 
OnErrorGoto(?ErrorHandler)
PokeS(10, "Hello World") 
End
ErrorHandler:
OpenConsole()
Print("OnError test")
End   
CompilerIf #PB_Compiler_LineNumbering=0
  CompilerError "Please switch Compiler Option OnError on."
CompilerEndIf
CompilerIf #PB_Compiler_Debugger=1
  CompilerError "Please switch Compiler Option Start Debugger off."
CompilerEndIf
CompilerIf #PB_Compiler_Backend<>#PB_Backend_C Or #PB_Compiler_Processor<>#PB_Processor_x64 Or #PB_Compiler_OS<>#PB_OS_Windows
  CompilerError "Please use Windows x64 C Backend."
CompilerEndIf 
https://www.purebasic.fr/english/viewtopic.php?t=78569
User_Russian
Addict
Addict
Posts: 1521
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: OnErrorCall not working

Post by User_Russian »

Similar problem in PB 6.20 ARM64.
OnErrorCall() does not work (no error message).
OnErrorGoto() missing
OnErrorGoto() is not a function, array, list, map or macro.
User avatar
Caronte3D
Addict
Addict
Posts: 1361
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: OnErrorCall not working

Post by Caronte3D »

OnError library seems not to work for me, no matter what compiler use, it doesn't work on latest PB versions. :cry:
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

Re: OnErrorCall not working

Post by Thorium »

OnErrorGoto also does not work under c x64 backend.
User avatar
skywalk
Addict
Addict
Posts: 4213
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: OnErrorCall not working

Post by skywalk »

I never got onerror calls to work so I just abandoned efforts and use log files instead.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Caronte3D
Addict
Addict
Posts: 1361
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: OnErrorCall not working

Post by Caronte3D »

I used in the past (very useful) and hope someday will comeback
Post Reply