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

improve handling of deferred response errors in rhai scripts #2945

Merged
merged 12 commits into from
Apr 20, 2023

Conversation

garypen
Copy link
Contributor

@garypen garypen commented Apr 13, 2023

Currently, if a rhai script errors in rhai, the rhai plugin ignores the error and returns None in the stream of results.

This has two unfortunate aspects:

  • the error is not propagated to the client
  • the stream is terminated (silently)

The fix captures the error and propagates the response to the client.

Fixes #2935 #2936

Checklist

Complete the checklist (and note appropriate exceptions) before a final PR is raised.

  • Changes are compatible[^1]
  • Documentation[^2] completed
  • Performance impact assessed and acceptable
  • Tests added and passing[^3]
    • Unit Tests
      - [ ] Integration Tests
    • Manual Tests

Exceptions

Note any exceptions here

Notes

[^1]. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.
[^2]. Configuration is an important part of many changes. Where applicable please try to document configuration examples.
[^3]. Tick whichever testing boxes are applicable. If you are adding Manual Tests:
- please document the manual testing (extensively) in the Exceptions.
- please raise a separate issue to automate the test and label it (or ask for it to be labeled) as manual test

fixes: #2935

Currently, if a rhai script errors in rhai, the rhai plugin ignores the
error and returns None in the stream of results.

This has two unfortunate aspects:
 - the error is not propagated to the client
 - the stream is terminated (silently)

The fix captures the error and propagates the response to the client.
@github-actions

This comment has been minimized.

update the documentation to reflect the change
Turns out that we can just hard-code the is_primary() based on the type
of response we provide into the rhai callback.

I've updated the tests to reflect the change.
@garypen garypen linked an issue Apr 14, 2023 that may be closed by this pull request
@garypen garypen merged commit c541edf into dev Apr 20, 2023
@garypen garypen deleted the garypen/2935-rhai-defer-error branch April 20, 2023 09:33
@abernix abernix mentioned this pull request May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants