Last active
September 3, 2016 17:30
-
-
Save expede/cfc28fa596e0fbd3b8992f3f88b81ecf to your computer and use it in GitHub Desktop.
This file contains 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
use Exceptional | |
# Success case | |
iex> OtherFile.read("./existing_file.txt") >>> String.length | |
1000 | |
# Error case | |
iex> OtherFile.read("./missing.file") >>> String.length | |
**(OtherFile.NotFoundError) File not found at ./missing.file | |
# Explicit function | |
iex> OtherFile.read("./missing.file") |> raise_or_continue!(String.length) | |
**(OtherFile.NotFoundError) File not found at ./missing.file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment