Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Consolidates all of the errors produced by the client into a single
enum
. Although not entirely needed, the majority of errors that could be potentially thrown were fromAPIManager.NetworkError
. With that being an internal type, that limited the ability of a client consumer from being able to type catch and potentially resolve issues. All errors are now of typeFlagsmithError
.Additional notes:
Router
to its own file and added the ability to pass aJSONEncoder
to the request method enabling unit tests.APIManager
request method to not need theemptyResponse
parameter. The conditional checking for a specific type and flag was a bit cumbersome to follow. Now the completion block dictates if the response is decoded vs just indicating success/failure.fatalError()
in theAPIManager
with an error completion. Questionable wether the library should cause an application to crash for being misconfigured.Router
andAPIManager
where possible.I know I can go a bit overboard with some changes and opinionated behaviors. Please, feel free to reject or request changes. The company I work for is likely adopting Flagsmith, hence all the PRs!