| 1 |
|
defmodule DaProductAppWeb.ErrorJSON do |
| 2 |
|
@moduledoc """ |
| 3 |
|
This module is invoked by your endpoint in case of errors on JSON requests. |
| 4 |
|
|
| 5 |
|
See config/config.exs. |
| 6 |
|
""" |
| 7 |
|
|
| 8 |
|
# If you want to customize a particular status code, |
| 9 |
|
# you may add your own clauses, such as: |
| 10 |
|
# |
| 11 |
|
# def render("500.json", _assigns) do |
| 12 |
|
# %{errors: %{detail: "Internal Server Error"}} |
| 13 |
|
# end |
| 14 |
|
|
| 15 |
|
# By default, Phoenix returns the status message from |
| 16 |
|
# the template name. For example, "404.json" becomes |
| 17 |
|
# "Not Found". |
| 18 |
|
def render(template, _assigns) do |
| 19 |
2 |
%{errors: %{detail: Phoenix.Controller.status_message_from_template(template)}} |
| 20 |
|
end |
| 21 |
|
end |