Skip to content

Instantly share code, notes, and snippets.

@expede
Last active September 2, 2016 14:20
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/bde610d98f26e0b689b7687f91556118 to your computer and use it in GitHub Desktop.
Save expede/bde610d98f26e0b689b7687f91556118 to your computer and use it in GitHub Desktop.
search_result = find_book(title: title)
case search_result do
page = %Page{} -> render(page)
%Ecto.MultipleResultsError{} when is_series(title) ->
%Book.SeriesAreNotBooksError{
message: "#{title} is a series, not a book.",
title: title,
series: search_result,
plug_status: 422
}
other_exception -> other_exception
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment