-
Notifications
You must be signed in to change notification settings - Fork 479
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
Handle error thrown by fact #311
Comments
I have just found that a fact throwing an error will kick back from try {
await engine.run()
} catch (error) {
engine.stop()
} However, the remaining rule facts somehow continue to execute on the node.js process loop outside the Is there any way to prevent this short of never throwing an exception from a fact? |
Turns out the if (error.almanac) {
// Resolve remaining fact cache to prevent continuing async execution
await Promise.allSettled(error.almanac.factResultsCache.values())
} |
This is effectively a process/memory leak. Can this be included in Milestone 7? |
Another potentially useful feature here would be to have an event handler for "error":
|
I'm trying to figure out what the Engine does it a Fact function throws an exception. As far as I can tell, there is no event handler for this and it doesn't return the error as the Fact value or anything like that. It also doesn't seem to be caught by either of the existing
success
orfailure
events. Is this supported in some way or does the entireengine.run()
bomb out?The text was updated successfully, but these errors were encountered: