Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should methods like MatrixClient.getRooms() throw a warning/error if client was not started? #904

Open
cedricvanrompay opened this issue Apr 25, 2019 · 1 comment

Comments

@cedricvanrompay
Copy link
Contributor

cedricvanrompay commented Apr 25, 2019

I lost quite some time with a bug that was caused by me calling MatrixClient.createRoom then MatrixClient.getRooms without having called MatrixClient.startClient (as a result the client was not syncing and not updating its room list, even though the call to createRoom did return successfully with a room Id).

I think that, unless there are some use cases where it makes sense to call MatrixClient.getRooms on a client that has not been started yet, the method should probably throw an error or a warning if the client was not started.

This would apply to every method that requires the client to be synchronizing.

@turt2live
Copy link
Member

I don't think it explicitly requires the client to be syncing: if the client was syncing, stored some data, and was re-loaded from that data then it should have rooms to report. Instead, clarifying the documentation on functions like this to say that they are more or less pointless without a syncing client could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants