mirror of
https://github.com/plausible/analytics.git
synced 2024-12-24 01:54:34 +03:00
a4b9c3b8ba
* Disable super-admin checks on small build * Mute a test writing to stdout * Move sampling outside of small build * Convert waiting_first_pageview to heex and stop relying on env vars * Set site limit unlimited on small build * Stop relying on app env to get trial expiry * Remove custom domains - including migration * Remove is_selfhosted from layout view * Quota fixup * Stop relying on app env for self hosted registration * Stop relying on app env for pass reset success * Apply on_trial? check only on full build * Update templates relying on app env * Adjusts auth controller tests for small build * Trial fixup * Fixup * Stop relying on app env * Rest of the fsckn owl * Update typespecs * Fix dialyzer warning * Remove unused module * Credo + format * GeoIP is not, for full build * Use `small_build?()` where applicable * Implement bypassing FirstLaunchPlug without insertions * Get Marko's patchde58a18a85
* Test is-dbip=false presence * Fix typespec * Remove future hardcodes * Handle `nil` from `Plausible.Geo.database_type()` * Remove XXX marker * Use one typespec for two clauses * Introduce `MIX_ENV=small_dev` * Revert "Use one typespec for two clauses" This reverts commit8d8cd21764
.
63 lines
1.6 KiB
Elixir
63 lines
1.6 KiB
Elixir
defmodule PlausibleWeb.ErrorView do
|
|
use Plausible
|
|
use PlausibleWeb, :view
|
|
|
|
def render("500.json", %{conn: %{private: %{PlausibleWeb.Plugins.API.Router => _}}}) do
|
|
contact_support_note =
|
|
on_full_build do
|
|
"If the problem persists please contact support@plausible.io"
|
|
end
|
|
|
|
%{
|
|
errors: [
|
|
%{detail: "Internal server error, please try again. #{contact_support_note}"}
|
|
]
|
|
}
|
|
end
|
|
|
|
def render("500.json", _assigns) do
|
|
%{
|
|
status: 500,
|
|
message: "Server error"
|
|
}
|
|
end
|
|
|
|
def render("404.html", assigns) do
|
|
assigns =
|
|
assigns
|
|
|> Map.put(:status, 404)
|
|
|> Map.put_new(:message, "Oops! There's nothing here")
|
|
|
|
render("404_error.html", assigns)
|
|
end
|
|
|
|
def render(<<"5", _error_5xx::binary-size(2), ".html">>, assigns) do
|
|
current_user = assigns[:current_user]
|
|
last_event = Sentry.get_last_event_id_and_source()
|
|
|
|
case {current_user, last_event} do
|
|
{current_user, {event_id, :plug}}
|
|
when is_binary(event_id) and not is_nil(current_user) ->
|
|
opts = %{
|
|
trace_id: event_id,
|
|
user_name: current_user.name,
|
|
user_email: current_user.email
|
|
}
|
|
|
|
render("server_error.html", Map.merge(opts, assigns))
|
|
|
|
_ ->
|
|
render("server_error.html", assigns)
|
|
end
|
|
end
|
|
|
|
def template_not_found(template, assigns) do
|
|
assigns =
|
|
assigns
|
|
|> Map.put_new(:message, Phoenix.Controller.status_message_from_template(template))
|
|
|> Map.put(:status, String.trim_trailing(template, ".html"))
|
|
|
|
render("generic_error.html", assigns)
|
|
end
|
|
end
|