Skip to content

Improve error handling when PostHog is disabled in config #81

@urcadox

Description

@urcadox

Hi there,

When PostHog is disabled in the config, calling PostHog.capture/2 raises an ArgumentError with the following message:

[error] ** (ArgumentError) unknown registry: PostHog.Registry. Either the registry name is invalid or the registry is not running, possibly because its application isn't started

This forces users to wrap calls to PostHog.capture/2 to handle this case.

In my opinion, it should return something like {:error, :posthog_disabled} which is easier to ignore (and you can always use :ok = PostHog.capture(...) if you want).

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions