-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix auto-translation errors, drop some handled exceptions (sentr…
…y) (#2040)
- Loading branch information
Showing
6 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
backend/data/src/main/kotlin/io/tolgee/component/SentryBeforeSendCallback.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.tolgee.component | ||
|
||
import io.sentry.Hint | ||
import io.sentry.SentryEvent | ||
import io.sentry.SentryOptions | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class SentryBeforeSendCallback : SentryOptions.BeforeSendCallback { | ||
override fun execute(event: SentryEvent, hint: Hint): SentryEvent? { | ||
if (event.containsMessage("Failed to send message to MessageChannel")) { | ||
return null | ||
} | ||
|
||
if (event.containsExceptionOfType("FailedDontRequeueException")) { | ||
return null | ||
} | ||
|
||
if (event.containsExceptionOfType("ClientAbortException")) { | ||
return null | ||
} | ||
|
||
if (event.containsMessage("Cannot render error page for request [/websocket")) return null | ||
|
||
return event | ||
} | ||
|
||
private fun SentryEvent.containsMessage(string: String): Boolean { | ||
return message?.formatted?.contains(string) == true | ||
} | ||
|
||
private fun SentryEvent.containsExceptionOfType(type: String) = | ||
exceptions?.any { it.type?.contains(type) == true } == true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters