on main help sign in
chore: use posthog's default exception reporting

We had a manual handling since now, but since then PostHog added official support via their SDK. This should give us stack traces!

commit1aea2593e9c78f72b1f669e794ed54c51ee0267d authorAndrey Nering <andreynering@users.noreply.github.com> dateFri 16 Jan 2026, 14:50 (9 months ago) parente5e45ad
1 file changed+11−13
internal/event/event.go+11−13
internal/event/event.go+11−13
@@ -7,6 +7,7 @@ import (
77 "path/filepath"
88 "reflect"
99 "runtime"
10+ "time"
1011
1112 "github.com/charmbracelet/crush/internal/version"
1213 "github.com/posthog/posthog-go"
@@ -85,19 +86,16 @@ func Error(err any, props ...any) {
8586 if client == nil {
8687 return
8788 }
88− // The PostHog Go client does not yet support sending exceptions.
89− // We're mimicking the behavior by sending the minimal info required
90− // for PostHog to recognize this as an exception event.
91− props = append(
92− []any{
93− "$exception_list",
94− []map[string]string{
95− {"type": reflect.TypeOf(err).String(), "value": fmt.Sprintf("%v", err)},
96− },
97− },
98− props...,
99− )
100− send("$exception", props...)
89+ posthogErr := client.Enqueue(posthog.NewDefaultException(
90+ time.Now(),
91+ distinctId,
92+ reflect.TypeOf(err).String(),
93+ fmt.Sprintf("%v", err),
94+ ))
95+ if err != nil {
96+ slog.Error("Failed to enqueue PostHog error", "err", err, "props", props, "posthogErr", posthogErr)
97+ return
98+ }
10199}
102100
103101func Flush() {