Unleash / unleash-proxy-client-js

A browser client that can be used together with the unleash-proxy.
Apache License 2.0
47 stars 46 forks source link

enhancement: emit errors if response is not ok #109

Closed chriswk closed 2 years ago

chriswk commented 2 years ago

This now checks if response is not ok, if it is not, we emit an error object with a type and a statusCode.

I'm wondering if we should add more logic when we receive a 401 and just stop the poll; but that can be a different improvement. fixes #108

chriswk commented 2 years ago

I'll add a couple of tests verifying this behaviour.

ivarconr commented 2 years ago

I'm wondering if we should add more logic when we receive a 401 and just stop the poll; but that can be a different improvement.

Jeah, I guess the user can also call stop themselves in that scenario if they like. A 401 could be temporary (e.g. incorrectly sending traffic to a different server)

fivaz commented 2 years ago

how can I omit those errors ? my console log is being spammed by the same error (my feature flag is working fine)

grovertb commented 2 years ago

Hi everyone, just like @fivaz it shows me the same error. Your support please on how to bypass it, my feature flag works fine.

melloware commented 2 years ago

I think you introduced this issue: https://github.com/Unleash/unleash-proxy-client-js/issues/111

I think you are missing 304 in your test its reporting as an error when its an OK.

melloware commented 2 years ago

I think this line...

if (response.ok && response.status !== 304) {

needs to be

if (response.ok || response.status === 304) {