Page 1 of 1
OnErrorCall not working
Posted: Mon Feb 05, 2024 3:31 pm
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)
Re: OnErrorCall not working
Posted: Mon Feb 05, 2024 5:08 pm
by ChrisR
The bug seems to be only with C Backend x64. It looks good with C Backend x86.
Re: OnErrorCall not working
Posted: Mon Feb 05, 2024 5:16 pm
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
Re: OnErrorCall not working
Posted: Sun Mar 09, 2025 8:18 pm
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.
Re: OnErrorCall not working
Posted: Sun Mar 09, 2025 8:43 pm
by Caronte3D
OnError library seems not to work for me, no matter what compiler use, it doesn't work on latest PB versions.

Re: OnErrorCall not working
Posted: Sat Mar 22, 2025 1:19 pm
by Thorium
OnErrorGoto also does not work under c x64 backend.
Re: OnErrorCall not working
Posted: Sat Mar 22, 2025 2:14 pm
by skywalk
I never got onerror calls to work so I just abandoned efforts and use log files instead.
Re: OnErrorCall not working
Posted: Sat Mar 22, 2025 5:08 pm
by Caronte3D
I used in the past (very useful) and hope someday will comeback