Skip to content

Remove ErrorsUtil #67

Description

@levibostian

The class ErrorsUtil is used to compare errors for classes that conform to Equatable. (1) That's hacky to compare Error for equatable, (2) it's not up to us to conform Error to Equatable and (3) I don't trust it. When using a hack, it gives you an opportunity to step back and ask if you can do something better.

Tasks:

  • Remove the Error from OnlineDataState and LocalDataState. These structs exist to contain the state of the data, not the state of the refresh. By removing the Error from these objects, it will make these structs be closer to their purpose, make the code more simple and allow us to fix this issue.

To the end user they may not notice much. We may change the API to whenCache {} and whenNoCache {} where the errors do not exist in there and instead move that logic into the result returned from the Observable. We could change OnlineRepository.observe() to return a tuple, a new struct, or a Result<> type instead that houses an error.

This will remove some hackiness from the library, make the API easier to work with when observing the cache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions