aboutsummaryrefslogtreecommitdiff
path: root/web/views
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2017-02-17 11:33:27 +0100
committerneodarz <neodarz@neodarz.net>2017-02-17 11:33:27 +0100
commit708dc012953f555e0434b366cb004977d0821979 (patch)
tree04c2ba93a0740c123a650a113747f25b4080a0a3 /web/views
parent92237133291873f841ccb1808ebc45318494dec0 (diff)
downloadthe_transcriber_backend-708dc012953f555e0434b366cb004977d0821979.tar.xz
the_transcriber_backend-708dc012953f555e0434b366cb004977d0821979.zip
Adding error handling
Diffstat (limited to '')
-rw-r--r--web/views/error_view.ex11
1 files changed, 11 insertions, 0 deletions
diff --git a/web/views/error_view.ex b/web/views/error_view.ex
index e47ebee..5906829 100644
--- a/web/views/error_view.ex
+++ b/web/views/error_view.ex
@@ -14,4 +14,15 @@ defmodule TheTranscriberBackend.ErrorView do
def template_not_found(_template, assigns) do
render "500.html", assigns
end
+
+ def render("404.json", %{reason: reason}) do
+ message = case reason do
+ %Phoenix.Router.NoRouteError{} -> "Route not found"
+ %Ecto.NoResultsError{} -> "File not found in database !"
+ _ -> "Uncaught exception"
+ end
+ # ContactService.ResponseHelper.error(message)
+ %{error: message}
+end
+
end