diff --git a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/Comments.kt b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/Comments.kt index dd733feb..2f2751e6 100644 --- a/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/Comments.kt +++ b/common/src/main/kotlin/dev/msfjarvis/claw/common/comments/Comments.kt @@ -73,7 +73,11 @@ fun CommentsPage( ) { val postDetails by produceState(NetworkState.Loading) { - value = NetworkState.Success(getDetails(postId)) + runCatching { getDetails(postId) } + .fold( + onSuccess = { details -> value = NetworkState.Success(details) }, + onFailure = { value = NetworkState.Error("Failed to load comments") } + ) } when (postDetails) {