Skip to content

Standardize SDK init errors #324

@Zaimwa9

Description

@Zaimwa9

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

<!DOCTYPE html>
...
<title>Error</title>
...
<pre>Cannot POST /test/identities/</pre>
...

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions