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

Handle all kinds of errors in the workflow #10

Merged
merged 2 commits into from
Nov 10, 2023

Conversation

codeadict
Copy link
Contributor

@codeadict codeadict commented Nov 7, 2023

What

Handles all kinds of errors in the workflow, including "stop loop" (throw, exit) errors from Erlang that could be sent from Finch lower in the stack.

Why

Finch errors not not being caught by the rescue block, DD.

Jira ticket

CARS-13980

Steps to Validate/Verify

  1. In cars_platform apps/engine/mix.exs and apps/cars_web/mix.exs update the :pacer dep with {:pacer, git: "https://github.com/codeadict/pacer/", branch: "handle_erlang_stop_loops"}
  2. Verify an ISA (the cat picture listing) loads
  3. Verify the SRP behaves normally

Handles all kinds of errors in the workflow, including "stop loop" (throw, exit)
errors from Erlang that could be sent from Finch lower in the stack.

Co-authored-by: Eric Iacutone <[email protected]>
Comment on lines 28 to 32
field(:request_3,
resolver: &__MODULE__.do_error/1,
dependencies: [:custom_field],
default: :request_3
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an extra unit test that shows that we return the default value when a batched field throws or exits too? Similar to this test

test "all sorts of batch issues, but returns defaults and or resolved results" do
assert %BatchWorkflowWithMultipleResolverIssues{
a: 1,
b: "ddddefault",
c: "timed out so default here for c",
d: 24
} ==
Pacer.Workflow.execute(%BatchWorkflowWithMultipleResolverIssues{})
end

In fact, I think we can probably just add a resolver in that batch that throws an error and/or exits and add to the test for it too.

Copy link
Contributor

@zkayser zkayser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added a comment on adding to an existing test case that shows we can handle multiple different classes of failure on batch resolvers, but this looks good. Verified that we still handle the class of exception we have previously handled with rescue clauses and the unexpected cases where we got throws/exits.

Thank you!

@codeadict codeadict requested a review from zkayser November 10, 2023 15:07
@zkayser zkayser merged commit 97b8fba into carsdotcom:main Nov 10, 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
Development

Successfully merging this pull request may close these issues.

2 participants