Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem calling error handler from BEGIN...END SEQUENCE #1673

Open
cpyrgas opened this issue Jan 24, 2025 · 1 comment
Open

Problem calling error handler from BEGIN...END SEQUENCE #1673

cpyrgas opened this issue Jan 24, 2025 · 1 comment
Assignees
Labels

Comments

@cpyrgas
Copy link

cpyrgas commented Jan 24, 2025

https://www.xsharp.eu/forum/topic?p=32646#p32646

Following code prints in X#:

before BEGIN SEQUENCE .F. 
in BEGIN SEQUENCE .T. 
in RECOVER .F. 
after END SEQUENCE .F. 

so the ErrorHandler() function is not called at all, as it does in VO:

before BEGIN SEQUENCE .F. 
in BEGIN SEQUENCE .T. 
in ErrorHandler .T. // why is this line missing in X#?
in RECOVER .F. 
after END SEQUENCE .F. 
FUNCTION Start()  AS INT
	LOCAL oCB AS CODEBLOCK
	LOCAL err AS USUAL

	oCB := ErrorBlock( {|err| ErrorHandler(err) } )
	? "before BEGIN SEQUENCE", CanBreak()
	BEGIN SEQUENCE
		? "in BEGIN SEQUENCE", CanBreak()
		Error{}:Throw()
	RECOVER USING err      
		? "in RECOVER", CanBreak()
	END SEQUENCE
	ErrorBlock( oCB )
	?  "after END SEQUENCE", CanBreak() 
RETURN 0
	
FUNCTION ErrorHandler(err) AS USUAL
	?  "in ErrorHandler", CanBreak() 
	_Break(err)
	?  "in ErrorHandler after _break", CanBreak() 
RETURN NIL
@cpyrgas cpyrgas changed the title Problem calling error handler from EBGIND...END SEQUENCE Problem calling error handler from BEGIN...END SEQUENCE Jan 24, 2025
cpyrgas pushed a commit that referenced this issue Jan 24, 2025
@RobertvanderHulst RobertvanderHulst self-assigned this Jan 24, 2025
@RobertvanderHulst
Copy link
Member

Some comments:
This should have worked as expected when the /vo17 compiler option (VO compatible BEGIN SEQUENCE .. END SEQUENCE) was enabled, but I see now that the code that gets generated is not correctly doing what it is supposed to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants