Skip to content

Instantly share code, notes, and snippets.

@sescobb27
Last active August 29, 2018 15:35
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 sescobb27/b5c889f22f405f8e14b2e47ff37ffc36 to your computer and use it in GitHub Desktop.
Save sescobb27/b5c889f22f405f8e14b2e47ff37ffc36 to your computer and use it in GitHub Desktop.
throw vs raise elixir
creating | handling with | where y is
-----------------------------------------------------
raise x | rescue y | %RuntimeError{message: x}
error(x) | rescue y | %ErlangError{original: x}
throw x | catch y | x
exit(x) | catch :exit, y | x
creating | handling with | where y is | and z is
-----------------------------------------------------------------
raise x | catch y, z | :error | %RuntimeError{message: x}
error(x) | catch y, z | :error | x
throw x | catch y, z | :throw | x
exit(x) | catch y, z | :exit | x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment