Skip to content

Instantly share code, notes, and snippets.

@davich
Created April 28, 2018 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davich/f037a63222d79cd68ddb3a35f130d8f2 to your computer and use it in GitHub Desktop.
Save davich/f037a63222d79cd68ddb3a35f130d8f2 to your computer and use it in GitHub Desktop.
Sad path programming using Elixir's 'with' command
def handle_event(persisted_event) do
with :not_handled <- ActionFramework.handle_event(persisted_event),
:not_handled <- Action.handle_event(persisted_event),
:not_handled <- Comment.handle_event(persisted_event) do
:error
else
_ -> :ok
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment