Created
November 25, 2017 16:21
-
-
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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