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

Trap exceptions during generation #1056

Merged
merged 34 commits into from Apr 6, 2024
Merged

Conversation

joelrosario
Copy link
Collaborator

What:

Trap exceptions and return them as return values, rather than letting them bubble up naturally.

Why:

Sequences generate values just-in-time, so in some cases the usual exception handlers will not get a chance to fire and add metadata. It also becomes harder to reason about exceptions.

How:

HttpRequestPattern.newBasedOn returns Sequence<ReturnValue<HttpRequestPattern>>, and this signature bubbles up. Within HttpRequestPattern.newBasedOn:

  1. exceptions as sequence generation time are trapped and returned as ReturnValue objects
  2. exceptions at HttpRequestPattern realisation time (flatMaps) are trapped (did this by implementing my own flatMap) and returned as a ReturnValue object.

We still validate the rows before running tests, in an attempt to catch errors early before running contract tests.

Checklist:

…asedOnR and HttpRequestPattern.negativeBasedOn
Renamed newBasedOnR and negativeBasedOnR, removing the R and eliminating
 the older newBasedOn and negativeBasedOn, which had been made into
 wrappers of their R methods in this branch.
Deleted all Feature.executeTest methods except 1, and cleaned
it up
@joelrosario joelrosario self-assigned this Apr 5, 2024
@joelrosario joelrosario merged commit df52bd3 into main Apr 6, 2024
3 checks passed
@joelrosario joelrosario deleted the trap_exceptions_during_generation branch April 6, 2024 15:32
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

Successfully merging this pull request may close these issues.

None yet

1 participant