@@ -13,6 +13,7 @@ import org.mockito.kotlin.whenever
1313import java.io.BufferedWriter
1414import java.io.ByteArrayOutputStream
1515import java.io.File
16+ import java.io.IOException
1617import java.io.OutputStreamWriter
1718import java.nio.charset.Charset
1819import kotlin.test.AfterTest
@@ -120,7 +121,7 @@ class SentryEnvelopeItemTest {
120121
121122 val item = SentryEnvelopeItem .fromAttachment(fixture.serializer, fixture.options.logger, attachment, fixture.maxAttachmentSize)
122123
123- assertFailsWith<SentryEnvelopeException >(
124+ assertFailsWith<IOException >(
124125 " Reading the attachment ${attachment.pathname} failed, because the file located at " +
125126 " the path is not a file."
126127 ) {
@@ -140,7 +141,7 @@ class SentryEnvelopeItemTest {
140141
141142 val item = SentryEnvelopeItem .fromAttachment(fixture.serializer, fixture.options.logger, attachment, fixture.maxAttachmentSize)
142143
143- assertFailsWith<SentryEnvelopeException >(
144+ assertFailsWith<IOException >(
144145 " Reading the attachment ${attachment.pathname} failed, " +
145146 " because can't read the file."
146147 ) {
@@ -163,7 +164,7 @@ class SentryEnvelopeItemTest {
163164
164165 val item = SentryEnvelopeItem .fromAttachment(fixture.serializer, fixture.options.logger, attachment, fixture.maxAttachmentSize)
165166
166- assertFailsWith<SentryEnvelopeException >(" Reading the attachment ${attachment.pathname} failed." ) {
167+ assertFailsWith<SecurityException >(" Reading the attachment ${attachment.pathname} failed." ) {
167168 item.data
168169 }
169170
@@ -244,12 +245,12 @@ class SentryEnvelopeItemTest {
244245 file.writeBytes(fixture.bytesTooBig)
245246 val attachment = Attachment (file.path)
246247
247- val exception = assertFailsWith<SentryEnvelopeException > {
248+ val exception = assertFailsWith<IOException > {
248249 SentryEnvelopeItem .fromAttachment(fixture.serializer, fixture.options.logger, attachment, fixture.maxAttachmentSize).data
249250 }
250251
251252 assertEquals(
252- " Dropping item , because its size located at " +
253+ " Reading file failed , because size located at " +
253254 " '${fixture.pathname} ' with ${file.length()} bytes is bigger than the maximum " +
254255 " allowed size of ${fixture.maxAttachmentSize} bytes." ,
255256 exception.message
@@ -317,7 +318,7 @@ class SentryEnvelopeItemTest {
317318 }
318319 file.writeBytes(fixture.bytes)
319320 file.setReadable(false )
320- assertFailsWith<SentryEnvelopeException >(" Dropping profiling trace data, because the file ${file.path} doesn't exists" ) {
321+ assertFailsWith<IOException >(" Dropping profiling trace data, because the file ${file.path} doesn't exists" ) {
321322 SentryEnvelopeItem .fromProfilingTrace(profilingTraceData, fixture.maxAttachmentSize, mock()).data
322323 }
323324 }
@@ -344,12 +345,12 @@ class SentryEnvelopeItemTest {
344345 whenever(it.traceFile).thenReturn(file)
345346 }
346347
347- val exception = assertFailsWith<SentryEnvelopeException > {
348+ val exception = assertFailsWith<IOException > {
348349 SentryEnvelopeItem .fromProfilingTrace(profilingTraceData, fixture.maxAttachmentSize, mock()).data
349350 }
350351
351352 assertEquals(
352- " Dropping item , because its size located at " +
353+ " Reading file failed , because size located at " +
353354 " '${fixture.pathname} ' with ${file.length()} bytes is bigger than the maximum " +
354355 " allowed size of ${fixture.maxAttachmentSize} bytes." ,
355356 exception.message
0 commit comments