Skip to content

Instantly share code, notes, and snippets.

@expede
Last active September 3, 2016 17:30
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 expede/cfc28fa596e0fbd3b8992f3f88b81ecf to your computer and use it in GitHub Desktop.
Save expede/cfc28fa596e0fbd3b8992f3f88b81ecf to your computer and use it in GitHub Desktop.
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