mirror of
https://github.com/plausible/analytics.git
synced 2024-12-26 11:02:52 +03:00
c1a1d697a4
* Revert "Remove unused RocketIcon" This reverts commitc5e8d0c172
. * Revert "Display either hash or actual error message" This reverts commit0c091ab35f
. * Revert "Use ApiErrorNotice in funnels" This reverts commit5929de248e
. * Revert "Don't render "No data yet" when there's a NetworkError for example" This reverts commit70bee07632
. * Revert "Show the sinking shuttle notice whenever an API error occurs" This reverts commit9a62c8af2b
. * Revert "Add Hahash dependency" This reverts commitb94207ea0a
. * Remove support hash
21 lines
591 B
Elixir
21 lines
591 B
Elixir
defmodule PlausibleWeb.Plugs.ErrorHandler do
|
|
@moduledoc """
|
|
A thin macro wrapper around Plug.ErrorHandler that adds Sentry context
|
|
containing a readable support hash presented to the users.
|
|
To be used in the user-facing APIs, so that we don't leak internal
|
|
server errors.
|
|
|
|
Usage: `use PlausibleWeb.Plugs.ErrorHandler`
|
|
"""
|
|
defmacro __using__(_) do
|
|
quote do
|
|
use Plug.ErrorHandler
|
|
|
|
@impl Plug.ErrorHandler
|
|
def handle_errors(conn, %{kind: kind, reason: reason}) do
|
|
json(conn, %{error: "internal server error"})
|
|
end
|
|
end
|
|
end
|
|
end
|