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

Pass better information of operation failures #179

Merged
merged 3 commits into from
May 14, 2024
Merged

Pass better information of operation failures #179

merged 3 commits into from
May 14, 2024

Conversation

skhugh
Copy link
Contributor

@skhugh skhugh commented May 13, 2024

What this PR does / why we need it?

Changes return type of public operations from Boolean to Result for better information.
This can help users to handle exceptions more precisely.

Also bumps libraries to latest versions.

Any background context you want to provide?

What are the relevant tickets?

Fixes #

Checklist

  • Added relevant tests or not required
  • Didn't break anything

@skhugh skhugh requested a review from 7hong13 May 13, 2024 12:37
@skhugh skhugh self-assigned this May 13, 2024
@@ -24,7 +24,9 @@ class KanbanBoardViewModel(private val client: Client) : ViewModel() {

init {
viewModelScope.launch {
if (client.activateAsync().await() && client.attachAsync(document).await()) {
if (client.activateAsync().await().isSuccess &&
client.attachAsync(document).await().isFailure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be client.attachAsync(document).await().isSuccess

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done bb70e2e

@@ -129,7 +130,7 @@ public class Document(
public fun updateAsync(
message: String? = null,
updater: suspend (root: JsonObject, presence: Presence) -> Unit,
): Deferred<Boolean> {
): Deferred<Result<Unit>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typealias OperationResult can be applied here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done bb70e2e

@skhugh skhugh merged commit 2ac770b into main May 14, 2024
4 of 6 checks passed
@skhugh skhugh deleted the result branch May 14, 2024 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants