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

Can we throw custom exception from child in schema? #43

Closed
kijujjav opened this issue Apr 14, 2021 · 2 comments
Closed

Can we throw custom exception from child in schema? #43

kijujjav opened this issue Apr 14, 2021 · 2 comments

Comments

@kijujjav
Copy link
Collaborator

I have an use case where if a specific child selector becomes true, I want to throw an exception. is there a way to do this today?

@TravisOnGit
Copy link
Member

Hey kijujjav,

Upon selecting the specific child, that child TreeNode could have an Action that throws YourCustomException. The TreeWalkerSession.WalkTree will throw an ActionTimeoutException with YourCustomException as the InnerException.

If you wanted to throw the exception during the child selection itself (without visiting the next node), then you could do that as well. Just throw the exception in the ShouldSelect via the UserContext if the statement is true. The TreeWalkerSession.WalkTree will throw an EvaluateDynamicPropertyException with an InnerException containing YourCustomException in this case. The difference here is that the persisted CurrentTreeNode will not be updated, since you didn't visit the Child node yet.

Let me know if that does/doesn't answer your question.
Thanks,
--Travis

@TravisOnGit
Copy link
Member

Closing issue. Please re-open if you have any follow-up questions.

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

No branches or pull requests

2 participants