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

Revise generated server function catch clauses #497

Merged
merged 1 commit into from
Mar 26, 2020
Merged

Revise generated server function catch clauses #497

merged 1 commit into from
Mar 26, 2020

Conversation

jparise
Copy link
Collaborator

@jparise jparise commented Mar 25, 2020

wrap_with_try_catch/4 wraps a function handler body with try/1.

Our previous approach used rescue clauses for exception types defined
for this function in the schema. When no exception types are defined,
this resulted in us passing [] (empty list) into the macro as the
rescue argument. Elixir 1.10 doesn't like that:

expected -> clauses for :rescue in "try"

This revised approach moves exception type handling into the existing
catch list (and does away with rescue), merging them with our
existing catch clause that is common to all server functions. This
guarantees that we always have at least one clause to expand in the
macro.

Fixes #495

@jparise jparise requested a review from fishcakez March 25, 2020 00:29
@jparise jparise requested a review from scohen as a code owner March 25, 2020 00:29
wrap_with_try_catch/4 wraps a function handler body with a try/1.

Our previous approach used `rescue` clauses for exception types defined
for this function in the schema. When no exception types are defined,
this resulted in us passing [] (empty list) into the macro as the
`rescue` argument. Elixir 1.10 doesn't like that:

  expected -> clauses for :rescue in "try"

This revised approach moves exception type handling into the existing
`catch` list (and does away with `rescue`), merging them with our
existing `catch` clause that is common to all server functions. This
guarantees that we always have at least one clause to expand in the
macro.
@jparise jparise changed the title Revise generation server function catch clauses Revise generated server function catch clauses Mar 25, 2020
@jparise jparise merged commit 02cf636 into pinterest:master Mar 26, 2020
@jparise jparise deleted the server-catch-clauses branch March 26, 2020 19:49
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.

Error: expected -> clauses for :rescue in "try"
2 participants