Challenge 2: NetworkResult Error Handling — Solution sealed class NetworkResult data class Success(val data: T) : NetworkResult() data class Error(val message: String) : NetworkResult() object Loading : NetworkResult() suspend fun fetchPosts(api: PostApiService): NetworkResult> { return try { NetworkResult.Success(api.getPosts()) } catch (e: IOException) { NetworkResult.Error("No internet connection") } catch (e: HttpException) { NetworkResult.Error("Server error: ${e.code()}") } } Notes: - The two catch blocks are ordered as separate, specific exception types (not one generic "catch (e: Exception)") so each failure mode gets a message that actually helps diagnose it — a user with no internet connection sees a different message than one who genuinely reached a broken server. - NetworkResult being covariant (Kotlin Intermediate Chapter 3) is what allows Error("...") — which is really a NetworkResult — to be returned directly from a function declared to return NetworkResult>. Without "out", this wouldn't compile. - api.getPosts() is a suspend call; wrapping it in try/catch works exactly like wrapping any other suspend function call, since fetchPosts itself is also declared suspend.