mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-03-22 04:42:03 +00:00
By specifying the `before_send` hook, we can easily drop events based on their data, such as `original_exception` which contains the original exception instance raised. Leveraging this, we can add a `report_to_sentry` parameter to `Web.LiveErrors.NotFound` to optionally ignore certain not found errors from going to Sentry.
22 lines
562 B
Elixir
22 lines
562 B
Elixir
defmodule Web.LiveErrors do
|
|
defmodule NotFoundError do
|
|
defexception message: "Not Found", report_to_sentry: true
|
|
|
|
defimpl Plug.Exception do
|
|
def status(_exception), do: 404
|
|
def actions(_exception), do: []
|
|
end
|
|
end
|
|
|
|
# this is not a styled error because only security scanners that
|
|
# try to manipulate the request will see it
|
|
defmodule InvalidParamsError do
|
|
defexception message: "Unprocessable Entity"
|
|
|
|
defimpl Plug.Exception do
|
|
def status(_exception), do: 422
|
|
def actions(_exception), do: []
|
|
end
|
|
end
|
|
end
|