Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7bbbe08
ref: fix test linting (#491)
marandaneto Jul 23, 2020
95cc5f4
fix: event.level fatal is not a crashed session (#492)
marandaneto Jul 23, 2020
50a2165
feat: drop store endpoint in favor of envelope (#490)
marandaneto Jul 24, 2020
2f3b563
fix: ktlint for kts files (#493)
marandaneto Jul 24, 2020
29fbcc7
sentry-java readme
bruno-garcia Jul 27, 2020
14a5e29
feat: rotate cache folder (#494)
marandaneto Jul 28, 2020
db5345b
Merge remote-tracking branch 'origin' into feat/sentry-java
maciejwalkowiak Jul 29, 2020
ad2e0d8
make EventProcessor.process Nullable (#507)
davemt Aug 5, 2020
707015f
Merge remote-tracking branch 'origin/master' into feat/sentry-java
maciejwalkowiak Aug 11, 2020
acfb973
Merge remote-tracking branch 'origin/master' into feat/sentry-java
maciejwalkowiak Aug 12, 2020
9607fea
fix merge conflict
marandaneto Aug 13, 2020
d18da36
Add Logback integration. (#511)
maciejwalkowiak Aug 20, 2020
d14445a
Merge branch 'master' into 3.0.0
marandaneto Aug 26, 2020
68c7ceb
Sentry Spring Boot Starter. (#517)
maciejwalkowiak Aug 27, 2020
2d6e215
Refactor binding options (#530)
maciejwalkowiak Aug 29, 2020
0a8bde6
Add `sendDefaultPii` flag to `SentryOptions`. (#531)
maciejwalkowiak Aug 30, 2020
82e4efe
Attach breadcrumbs to events triggered in Logback integration. (#532)
maciejwalkowiak Aug 31, 2020
944f478
Bump to 3.0.0-alpha.1 (#535)
marandaneto Sep 1, 2020
eefdd31
feat: enable release health by default (#534)
marandaneto Sep 1, 2020
df08324
Merge branch 'master' into 3.0.0
marandaneto Sep 2, 2020
35750dd
Add Log4j2 integration. (#537)
maciejwalkowiak Sep 2, 2020
3737aab
feat: session updates along with the event (#514)
marandaneto Sep 3, 2020
cd6f526
Merge remote-tracking branch 'origin/master' into feat/sentry-java
maciejwalkowiak Sep 3, 2020
3915ca4
fix: enable session tracking by default on sample (#538)
marandaneto Sep 3, 2020
9aad2cb
chore 3.0.0-alpha.1
marandaneto Sep 3, 2020
e767af6
prepare: 3.0.0-alpha.2
marandaneto Sep 3, 2020
b754303
Bump Gradle to 6.6.1
marandaneto Sep 3, 2020
60af521
Extract minimum required coverage by Jacoco plugin. (#541)
maciejwalkowiak Sep 4, 2020
799e581
Merge branch 'master' into 3.0.0
marandaneto Sep 4, 2020
923f9fc
Add Spring Integration. (#539)
maciejwalkowiak Sep 8, 2020
7845eb8
Merge branch '3.0.0' into feat/sentry-java
bruno-garcia Sep 8, 2020
89b7606
fix conflicts
marandaneto Sep 9, 2020
ed1b133
Merge branch 'master' into 3.0.0
marandaneto Sep 9, 2020
33766f4
ref: move init flag (#542)
marandaneto Sep 9, 2020
c891d6a
fix: Asserting events on Envelope sent to Transport (#548)
maciejwalkowiak Sep 9, 2020
ae0219d
Add option to set user information via `SentryUserProvider` (#549)
maciejwalkowiak Sep 9, 2020
cdb4530
Merge branch '3.0.0' into feat/sentry-java
bruno-garcia Sep 9, 2020
6d02f98
upgrade cache id
marandaneto Sep 10, 2020
dd0e7d8
Feat/sentry java fix kotlin (#552)
maciejwalkowiak Sep 10, 2020
188ef14
ref: sentry-core to sentry (#553)
bruno-garcia Sep 10, 2020
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
Prev Previous commit
Next Next commit
fix: event.level fatal is not a crashed session (#492)
  • Loading branch information
marandaneto authored Jul 23, 2020
commit 95cc5f4a72220e7ab4b72d1bcccacf6d41ba55ab
5 changes: 1 addition & 4 deletions sentry-core/src/main/java/io/sentry/core/SentryEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,11 @@ public void setDebugMeta(DebugMeta debugMeta) {
}

/**
* Returns true if Level is Fatal or any exception was unhandled by the user.
* Returns true if any exception was unhandled by the user.
*
* @return true if its crashed or false otherwise
*/
public boolean isCrashed() {
if (level == SentryLevel.FATAL) {
return true;
}
if (exception != null) {
for (SentryException e : exception.getValues()) {
if (e.getMechanism() != null
Expand Down
28 changes: 19 additions & 9 deletions sentry-core/src/test/java/io/sentry/core/SentryClientTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import io.sentry.core.hints.Cached
import io.sentry.core.hints.DiskFlushNotification
import io.sentry.core.hints.SessionEndHint
import io.sentry.core.hints.SessionUpdateHint
import io.sentry.core.protocol.Mechanism
import io.sentry.core.protocol.Request
import io.sentry.core.protocol.SdkVersion
import io.sentry.core.protocol.SentryException
Expand Down Expand Up @@ -465,11 +466,11 @@ class SentryClientTest {
}

@Test
fun `When event is Fatal or not handled, mark session as Crashed`() {
fun `When event is non handled, mark session as Crashed`() {
val scope = Scope(fixture.sentryOptions)
scope.startSession().current
val event = SentryEvent().apply {
level = SentryLevel.FATAL
exceptions = createNonHandledException()
}
fixture.getSut().updateSessionData(event, null, scope)
scope.withSession {
Expand All @@ -478,7 +479,7 @@ class SentryClientTest {
}

@Test
fun `When event is non fatal, keep level as it is`() {
fun `When event is handled, keep level as it is`() {
val scope = Scope(fixture.sentryOptions)
val session = scope.startSession().current
val level = session.status
Expand All @@ -488,11 +489,11 @@ class SentryClientTest {
}

@Test
fun `When event is Fatal, increase errorCount`() {
fun `When event is non handled, increase errorCount`() {
val scope = Scope(fixture.sentryOptions)
scope.startSession().current
val event = SentryEvent().apply {
level = SentryLevel.FATAL
exceptions = createNonHandledException()
}
fixture.getSut().updateSessionData(event, null, scope)
scope.withSession {
Expand All @@ -516,7 +517,7 @@ class SentryClientTest {
}

@Test
fun `When event is non fatal nor errored, do not increase errorsCount`() {
fun `When event is handled and not errored, do not increase errorsCount`() {
val scope = Scope(fixture.sentryOptions)
val session = scope.startSession().current
val errorCount = session.errorCount()
Expand Down Expand Up @@ -569,7 +570,7 @@ class SentryClientTest {
val sut = fixture.getSut()

val event = SentryEvent().apply {
level = SentryLevel.FATAL
exceptions = createNonHandledException()
}
val scope = Scope(fixture.sentryOptions)
scope.startSession()
Expand All @@ -586,7 +587,7 @@ class SentryClientTest {
val sut = fixture.getSut()

val event = SentryEvent().apply {
level = SentryLevel.FATAL
exceptions = createNonHandledException()
}
val scope = Scope(fixture.sentryOptions)
scope.startSession()
Expand All @@ -602,7 +603,7 @@ class SentryClientTest {
val sut = fixture.getSut()

val event = SentryEvent().apply {
level = SentryLevel.FATAL
exceptions = createNonHandledException()
}
val scope = Scope(fixture.sentryOptions)
scope.startSession().current
Expand Down Expand Up @@ -653,6 +654,15 @@ class SentryClientTest {
override fun isConnected(): Boolean = false
}

private fun createNonHandledException(): List<SentryException> {
val exception = SentryException().apply {
mechanism = Mechanism().apply {
isHandled = false
}
}
return listOf(exception)
}

internal class CustomCachedApplyScopeDataHint : Cached, ApplyScopeData

internal class DiskFlushNotificationHint : DiskFlushNotification {
Expand Down
22 changes: 11 additions & 11 deletions sentry-core/src/test/java/io/sentry/core/SentryEventTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ class SentryEventTest {
assertEquals(expected, DateUtils.getTimestampIsoFormat(actual.timestamp))
}

@Test
fun `if level Fatal it should return isCrashed=true`() {
val event = SentryEvent()
event.level = SentryLevel.FATAL
assertTrue(event.isCrashed)
}

@Test
fun `if mechanism is not handled, it should return isCrashed=true`() {
val mechanism = Mechanism()
Expand All @@ -58,26 +51,33 @@ class SentryEventTest {
}

@Test
fun `if mechanism is handled and level is not fatal, it should return isCrashed=false`() {
fun `if mechanism is handled, it should return isCrashed=false`() {
val mechanism = Mechanism()
mechanism.isHandled = true
val event = SentryEvent()
event.level = SentryLevel.ERROR
val factory = SentryExceptionFactory(mock())
val sentryExceptions = factory.getSentryExceptions(ExceptionMechanismException(mechanism, Throwable(), Thread()))
event.exceptions = sentryExceptions
assertFalse(event.isCrashed)
}

@Test
fun `if mechanism nas not handled flag and level is not fatal, it should return isCrashed=false`() {
fun `if mechanism handled flag is null, it should return isCrashed=false`() {
val mechanism = Mechanism()
mechanism.isHandled = null
val event = SentryEvent()
event.level = SentryLevel.ERROR
val factory = SentryExceptionFactory(mock())
val sentryExceptions = factory.getSentryExceptions(ExceptionMechanismException(mechanism, Throwable(), Thread()))
event.exceptions = sentryExceptions
assertFalse(event.isCrashed)
}

@Test
fun `if mechanism is not set, it should return isCrashed=false`() {
val event = SentryEvent()
val factory = SentryExceptionFactory(mock())
val sentryExceptions = factory.getSentryExceptions(RuntimeException(Throwable()))
event.exceptions = sentryExceptions
assertFalse(event.isCrashed)
}
}