Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Hint in beforeSend hook #84

Open
Legion2 opened this issue Apr 28, 2023 · 1 comment
Open

Provide Hint in beforeSend hook #84

Legion2 opened this issue Apr 28, 2023 · 1 comment

Comments

@Legion2
Copy link

Legion2 commented Apr 28, 2023

Currently it is very difficult to filter exceptions in common kotlin code, because we don't have access to the original exception object which causes the event. We need to compare the type name and package name of the exceptions as strings. What normally is a simple hint is MyException is turned into

inline fun <reified T> SentryException.isOfType(): Boolean {
    val qualifiedName = T::class.qualifiedName ?: error("Cannot get qualified name of ${T::class}")
    val module = qualifiedName.substringBeforeLast(".")
    val type = qualifiedName.substringAfterLast(".")
    return module == this.module && type == this.type
}

But this does not work for exception subtypes, so if there is an exception which is a subtype of MyException it is impossible to filter this with the current beforeSend because one had to know all subtypes to handle them all individually.

@buenaflor
Copy link
Contributor

buenaflor commented May 2, 2023

Hi, thanks for bringing it up. I'll take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

3 participants