@@ -7,6 +7,7 @@ import (
7 "path/filepath"
7 "path/filepath"
11 "github.com/charmbracelet/crush/internal/version"
12 "github.com/charmbracelet/crush/internal/version"
12 "github.com/posthog/posthog-go"
13 "github.com/posthog/posthog-go"
@@ -85,19 +86,16 @@ func Error(err any, props ...any) {
85 if client == nil {
86 if client == nil {
88− // The PostHog Go client does not yet support sending exceptions.
89+ posthogErr := client.Enqueue(posthog.NewDefaultException(
89− // We're mimicking the behavior by sending the minimal info required
90+ time.Now(),
90− // for PostHog to recognize this as an exception event.
91+ distinctId,
95− {"type": reflect.TypeOf(err).String(), "value": fmt.Sprintf("%v", err)},
92+ reflect.TypeOf(err).String(),
96− },
93+ fmt.Sprintf("%v", err),
100− send("$exception", props...)
95+ if err != nil {
96+ slog.Error("Failed to enqueue PostHog error", "err", err, "props", props, "posthogErr", posthogErr)
103func Flush() {
101func Flush() {