PostHog / posthog-node

Official PostHog Node library
MIT License
21 stars 19 forks source link

feat: handle non-ok responses in reloadFeatureFlags #53

Closed weyert closed 2 years ago

weyert commented 2 years ago

Changes

BREAKING CHANGE

If the backend when fetching feature flags via /api/feature-flag-endpoint returns a non-ok response (e.g. 502) the error will be silently ignored and the feature flags won't be updated

This fixes the issue when feature flag poller is running and the backend is returning 502 when reloading feature flags the library won't throw a runtime error which is unhandled and causes a unhandled rejection error in the node process.

If the DEBUG environment variable is set with posthog:node the silently ignored error mentioned above will be logged to the console

fixes #52

Checklist