Skip to content

TylerPachal/elixir-error-handling-blogpost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Error Handling Blogpost

The code in this repo is just example code which compliments this blogpost (read it for more details!). The tests are just meant to be example references (a lot of them fail on purpose) for the table in this README.

Trigger Handler Compatible? Code
raise rescue Link
raise catch/1 Link
raise catch/2 Link
throw rescue Link
throw catch/1 Link
throw catch/2 Link
exit rescue Link
exit catch/1 Link
exit catch/2 Link
:erlang.error rescue Link
:erlang.error catch/1 Link
:erlang.error catch/2 Link

Here is the same table re-arranged by the Handler column, where you can see that catch/2 handles all cases:

Trigger Handler Compatible? Code
raise catch/2 Link
throw catch/2 Link
exit catch/2 Link
:erlang.error catch/2 Link
raise rescue Link
throw rescue Link
exit rescue Link
:erlang.error rescue Link
raise catch/1 Link
throw catch/1 Link
exit catch/1 Link
:erlang.error catch/1 Link

TLDR: catch/2 will handle any kind of error.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages