File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
app/src/main/java/tech/httptoolkit/android Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
2828import io.sentry.Sentry
2929import kotlinx.coroutines.*
3030import java.lang.RuntimeException
31+ import java.net.ConnectException
32+ import java.net.SocketTimeoutException
3133import java.security.cert.Certificate
3234import java.security.cert.X509Certificate
3335
@@ -388,12 +390,17 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
388390
389391 Log .e(TAG , e.toString())
390392 e.printStackTrace()
391- Sentry .capture(e)
393+
392394 withContext(Dispatchers .Main ) {
393395 app.trackEvent(" Setup" , " reconnect-failed" )
394396 mainState = MainState .FAILED
395397 updateUi()
396398 }
399+
400+ // We report errors only that aren't simple connection failures
401+ if (e !is SocketTimeoutException && e !is ConnectException ) {
402+ Sentry .capture(e)
403+ }
397404 }
398405 }
399406
@@ -503,12 +510,17 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
503510 } catch (e: Exception ) {
504511 Log .e(TAG , e.toString())
505512 e.printStackTrace()
506- Sentry .capture(e)
513+
507514 withContext(Dispatchers .Main ) {
508515 app.trackEvent(" Setup" , " connect-failed" )
509516 mainState = MainState .FAILED
510517 updateUi()
511518 }
519+
520+ // We report errors only that aren't simple connection failures
521+ if (e !is SocketTimeoutException && e !is ConnectException ) {
522+ Sentry .capture(e)
523+ }
512524 }
513525 }
514526 }
You can’t perform that action at this time.
0 commit comments