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

Draft for discussion: on sending a signal when networking fails #1217

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import kotlinx.coroutines.withContext
import kotlinx.serialization.modules.EmptySerializersModule
import kotlinx.serialization.modules.SerializersModule
import okio.FileSystem
import okio.IOException
import okio.Path

/**
Expand Down Expand Up @@ -281,6 +282,9 @@ class ZiplineLoader internal constructor(
// If emit() threw a CancellationException, consider that emit to be successful.
// That's 'cause loadOnce() accepts an element and then immediately cancels the flow.
throw e
} catch (e: IOException) {
send(LoadResult.Failure(e))
return null
Comment on lines +285 to +287
Copy link
Author

Choose a reason for hiding this comment

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

I started working on the idea of "surfacing networking failure", and realized that for the catch (e: Exception) branch, does send(LoadResult.Failure(e)) already, and the downstream can check the type of the exception and if it's an IOException, the downstream will take it as an networking failure. So the change needed might be adding a documentation about IOException for LoadResult.Failure.

Or maybe I'm missing something / forgot something

Copy link
Author

Choose a reason for hiding this comment

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

talked over video, we don't need this, closing the draft

} catch (e: Exception) {
eventListener.applicationLoadFailed(applicationName, manifestUrl, e, startValue)
if (loadedManifest != null) {
Expand Down
Loading