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

Catching Fatal Errors #412

Open
ferenczAndras opened this issue Sep 14, 2023 · 2 comments
Open

Catching Fatal Errors #412

ferenczAndras opened this issue Sep 14, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@ferenczAndras
Copy link

Hi! Is there a way, to set up an error handler, whenever a fatal error happens, the app does not stop, but it gets caught?

For example, when there is no internet connection for the app, I am getting errors like:

FATAL EXCEPTION: main
 Process: com.app.app, PID: 5056
  java.nio.channels.UnresolvedAddressException
 at sun.nio.ch.Net.checkAddress(Net.java:107)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:663)
at io.ktor.network.sockets.SocketImpl.connect$ktor_network(SocketImpl.kt:44)
at io.ktor.network.sockets.ConnectUtilsJvmKt.connect(ConnectUtilsJvm.kt:21) 
at io.ktor.network.sockets.TcpSocketBuilder.connect(TcpSocketBuilder.kt:37)
at io.ktor.client.engine.cio.ConnectionFactory.connect(ConnectionFactory.kt:30)
@ferenczAndras ferenczAndras added the documentation Improvements or additions to documentation label Sep 14, 2023
@ferenczAndras
Copy link
Author

Hi, @Foso can you help me point to somewhere, where I can catch the Fatal Errors thrown if there is no internet on the device? What is the best practice for this?

@Foso
Copy link
Owner

Foso commented Oct 3, 2023

Hi @ferenczAndras , currently your only way to detect that exception is to wrap the code, where you do the request, inside a try-catch. I started working on improving that situation #389

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants