mirror of
https://github.com/plausible/analytics.git
synced 2025-01-01 14:04:46 +03:00
24 lines
601 B
Elixir
24 lines
601 B
Elixir
|
defmodule PlausibleWeb.Plugins.API.Views.Error do
|
||
|
@moduledoc """
|
||
|
View for rendering Plugins REST API errors
|
||
|
"""
|
||
|
use PlausibleWeb, :plugins_api_view
|
||
|
|
||
|
def template_not_found(_template, assigns) do
|
||
|
render("500.json", assigns)
|
||
|
end
|
||
|
|
||
|
@spec render(String.t(), map) :: map | binary()
|
||
|
def render("400.json", _assigns) do
|
||
|
%{errors: [%{detail: "Bad request"}]}
|
||
|
end
|
||
|
|
||
|
def render("404.json", _assigns) do
|
||
|
%{errors: [%{detail: "Plugins API: resource not found"}]}
|
||
|
end
|
||
|
|
||
|
def render("500.json", _assigns) do
|
||
|
%{errors: [%{detail: "Plugins API: Internal server error"}]}
|
||
|
end
|
||
|
end
|