Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Elixir Cookbook

You're reading from   Elixir Cookbook Unleash the full power of programming in Elixir with over 60 incredibly effective recipes

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher Packt
ISBN-13 9781784397517
Length 236 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Paulo Pereira Paulo Pereira
Author Profile Icon Paulo Pereira
Paulo Pereira
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Command Line FREE CHAPTER 2. Data Types and Structures 3. Strings and Binaries 4. Modules and Functions 5. Processes and Nodes 6. OTP – Open Telecom Platform 7. Cowboy and Phoenix 8. Interactions A. Installation and Further Reading Index

Handling errors and managing exceptions


We already approached the let it crash mantra. We saw in the previous two recipes how an Elixir system is able to deal with failures in processes and keep running.

Defensive programming is not encouraged at all by the principles that guide languages such as Elixir or Erlang. Even if we aren't writing defensively, it is still a good idea to control what happens when errors occur. Supervisors allow us to write code that keeps breaking and crashing and yet recovers from the crash. We will mainly find two categories of errors after compiling our code (compilation errors are outside this equation): runtime errors and logic errors. The former are easier to deal with, while the latter may become more difficult to reason and track.

Note

In distributed systems, a whole set of problems may rise due to race conditions, timing issues, network unreliability, and so on.

To track and solve this category of errors, we benefit from the ability to debug live systems via...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime