A client that starts under your supervision tree and a Phoenix error reporter. Wire `handle_errors/2` once and unhandled request errors flow to errorgap.
Add the dependency to mix.exs:
def deps do
[{:errorgap, "~> 0.2"}]
endIn config/runtime.exs:
config :errorgap,
endpoint: System.fetch_env!("ERRORGAP_ENDPOINT"),
project_slug: System.fetch_env!("ERRORGAP_PROJECT_SLUG"),
api_key: System.fetch_env!("ERRORGAP_API_KEY"),
environment: System.get_env("APP_ENV", "production")The Errorgap.Client GenServer starts under your application's supervision tree automatically.
defmodule MyAppWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :my_app
use Plug.ErrorHandler
@impl Plug.ErrorHandler
def handle_errors(conn, error_info) do
Errorgap.Plug.report(conn, error_info)
conn
end
endAdd a controller action that raises, hit it, then remove it:
def errorgap_test(_conn, _params) do
raise "Errorgap test error"
endConfirm your key and endpoint reach errorgap before wiring anything else — send one event straight to the ingestion API:
curl -sS -X POST "$ERRORGAP_ENDPOINT/api/projects/$ERRORGAP_PROJECT_SLUG/notices" \
-H "content-type: application/json" \
-H "x-errorgap-project-key: $ERRORGAP_API_KEY" \
-d '{"errors":[{"type":"ErrorgapInstallTest","message":"Errorgap install verification"}]}'A 201 with a group_id means ingestion works (202 = received but sampled; 401 = wrong key). Then trigger the test error above through the SDK. Your onboarding screen's Verify step checks the stack off automatically once the first event lands — it polls every three seconds.
Next: the full ingestion API, or browse every SDK.