Comments (4)
Hi @mattcreaser, thanks for the quick reply! That makes a lot of sense, let me implement that myself to prevent this exception from crashing my app then.
As a side note, I did file this other issue that's pretty similar, but it seems like that's throwing off a StreamResetException
which extends IOException
, so that should also be covered by adding this error handler for RxJava 👍
Are there any plans for integrating this into the AWS Amplify SDK?
Thanks Matt!
from amplify-android.
We'll need to do a little more investigation to see if we can catch these errors internally so that they don't propagate out, I took a quick look but it wasn't immediately obvious where to do so.
We won't be adding an RxJavaPlugins.setErrorHandler
however, as that is incorrect if done by a library, it is only appropriate to use for the end application code.
from amplify-android.
Thanks for the report @JornR94. As per the linked RxJava documentation the seeming cause here is that a socket exception (which often just means the network dropped) occurred after the emitter for the exception was already disposed.
While it's possible a bug could be fixed here on Amplify's side, this can also be worked around on the application side by ignoring such errors. The RxJava documentation has a good example, the relevant part is the ignoring of SocketException
.
RxJavaPlugins.setErrorHandler(e -> {
if (e instanceof UndeliverableException) {
e = e.getCause();
}
if ((e instanceof IOException) || (e instanceof SocketException)) {
// fine, irrelevant network problem or API that throws on cancellation
return;
}
if (e instanceof InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
return;
}
if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
// that's likely a bug in the application
Thread.currentThread().getUncaughtExceptionHandler()
.handleException(Thread.currentThread(), e);
return;
}
if (e instanceof IllegalStateException) {
// that's a bug in RxJava or in a custom operator
Thread.currentThread().getUncaughtExceptionHandler()
.handleException(Thread.currentThread(), e);
return;
}
Log.warning("Undeliverable exception received, not sure what to do", e);
});
from amplify-android.
Makes sense! I can't recall 100%, but I don't think I saw this mentioned anywhere in the implementation docs for Amplify on Android--I think this would be very valuable information to add to the GraphQL/DataStore implementation docs, to prevent unexpected crashes like these after adding the Amplify SDK
from amplify-android.
Related Issues (20)
- The master key android-keystore://amplify_master_key exists but is unusable HOT 5
- getIdentityProviderByIdentifier using escape hatch error HOT 4
- Amplify Kotlin Android feature for AWS IoT Core HOT 4
- Google.android.play:core has added this note for core:1.9.1 HOT 4
- Push notification body gets truncated HOT 6
- Auth signOut after signInWithSocialWebUI does not clear browser session HOT 3
- Fatal Exception in Http2Stream$FramingSource.read (DataStore / GraphQL) HOT 2
- Amplify configuration shared preferences are corrupted HOT 4
- Getting java.net.UnknownHostException: Unable to resolve host "cognito-idp.ap-south-1.amazonaws.com": No address associated with hostname HOT 3
- confirmResetPassword returns generic error message if incorrect verificationCode is provided. HOT 8
- [Storage]: Multi-part upload results in many progress updates with 100% status
- Is there a way to force signInWithWebUI to always use Chrome? HOT 20
- Amplify 1.x crashes when trying to download from S3 (MissingForegroundServiceTypeException: Starting FGS without a type) HOT 2
- "Error Occurs When Filtering API Queries Using Owner and Input Type with Generated GraphQL Schema (schema.json, mutations.graphql, queries.graphql, fragments.graphql, subscriptions.graphql) HOT 4
- Auth handle multiple user sessions concurrently HOT 1
- Update your com.google.android.play:core:1.10.3 on 1.38.8 HOT 1
- Failed to delete entry: CognitoIdentityProviderCache.aesKeyStoreAlias HOT 3
- Can we stay "SignedIn" when we start the app ? SignedInException a User is already Signed In HOT 1
- io.reactivex.rxjava3.exceptions.UndeliverableException in DataStore
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amplify-android.