Flagsmith / Flagsmith/flagsmith-js-client

Standardize SDK init errors

Open
#324 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
67
Forks
45
Avg merge
1d 8h
Merged PRs (30d)
4

Description

Error handling and `onError` calls during SDK initialization (flagsmith.init()) are currently inconsistent. Some are plain Error objects, others are raw strings unparsed HTML responses.

E.g
```

...
Error
...

Cannot POST /test/identities/

...
```

Standardize the errors, by having a FlagsmithError subclass for example would help handling them in a more programmatic way.

## DoD
- Each path in init throws its own specific error
- A new section in the javascript client documentation describes all the possible errors
- For each Flagsmith error, the tests should be able to confirm the error is caught, thrown and formatted as described per the decoumentation
- If a critical error happens, `client.initialised` should be false

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.