Skip to content

Instantly share code, notes, and snippets.

@TylerPachal
Created November 25, 2017 16:21
Show Gist options
  • Select an option

  • Save TylerPachal/f1f30b3dd6f36b0b8f9a914f3c27843c to your computer and use it in GitHub Desktop.

Select an option

Save TylerPachal/f1f30b3dd6f36b0b8f9a914f3c27843c to your computer and use it in GitHub Desktop.
This an example of how a runtime exception inside of a flow sends a :normal exit message
# This an example of how a runtime exception inside of a flow
# sends a :normal exit message.
#
# To run this code add the Flow dependency to the mix.exs file:
# {:flow, "~> 0.11"}
#
# The behaviour that I get is the stacktrace is printed to STDOUT,
# and the flush() function outputs a message like this:
# {:EXIT, #PID<0.144.0>, :normal}
# But I am expecting a non-normal exit message.
import IEx.Helpers
Process.flag(:trap_exit, true)
[3,2,1,0,-1,-2,-3]
|> Flow.from_enumerable()
|> Flow.map(&(10/&1)) # Generate a runtime error
|> Flow.start_link()
flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment