Skip to content
Draft
Show file tree
Hide file tree
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 @@ -43,7 +43,7 @@ public static String id(final @NotNull Context context) throws RuntimeException
return deviceId;
}
deviceId = readInstallationFile(installation);
} catch (Throwable e) {
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ import io.sentry.exception.ExceptionMechanismException
import io.sentry.exception.SentryHttpClientException
import io.sentry.protocol.Mechanism
import io.sentry.util.CookieUtils
import io.sentry.util.ExceptionUtils
import io.sentry.util.HttpUtils
import io.sentry.util.UrlUtils
import java.util.concurrent.TimeUnit
import kotlin.coroutines.cancellation.CancellationException

internal object SentryKtorClientUtils {
internal suspend fun captureClientError(
Expand Down Expand Up @@ -52,7 +54,12 @@ internal object SentryKtorClientUtils {
statusCode = response.status.value
try {
bodySize = response.bodyAsBytes().size.toLong()
} catch (_: Throwable) {}
} catch (e: CancellationException) {
throw e
} catch (@Suppress("TooGenericExceptionCaught") e: Throwable) {
// The HTTP engine can throw anything while reading the body. The body size is optional.
ExceptionUtils.rethrowIfFatal(e)
}
}

event.request = sentryRequest
Expand Down
2 changes: 1 addition & 1 deletion sentry/src/main/java/io/sentry/cache/tape/QueueFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ boolean ringRead(long position, byte[] buffer, int offset, int count) throws IOE
resetFile();
} catch (IOException e) {
throw e;
} catch (Throwable e) {
} catch (IndexOutOfBoundsException e) {
// most likely the file is corrupt, so we delete it and recreate, accepting data loss
resetFile();
}
Expand Down
Loading