Skip to content

Instantly share code, notes, and snippets.

@saa
Created February 21, 2015 10:30
Show Gist options
  • Save saa/c175ae731e32790de17f to your computer and use it in GitHub Desktop.
Save saa/c175ae731e32790de17f to your computer and use it in GitHub Desktop.
defmodule Pibblex.ErrorView do
use Pibblex.View
def render("404.json", _assings) do
%{errors: [%{message: "Not Found", code: :not_found}]}
end
def render("404.html", _assigns) do
%{errors: [%{message: "Not Found", code: :not_found}]}
end
def render("500.html", _assigns) do
"Server internal error - 500"
end
# Render all other templates as 500
def render(_, assigns) do
render "500.html", assigns
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment