#False positive app hangs on iOS with Godot
8 messages · Page 1 of 1 (latest)
False positive app hangs on iOS with Godot
Okay just saw that you can filter events before sending. Will close this once I'm sure it's working.
Hm that doesn't seem to work actually 😕 I think there may be a bug here? I turned off auto-init in settings and initialized Sentry at app start like this:
options.before_send = Globals.on_before_send_to_sentry
)```
and here's that before send method:
```func on_before_send_to_sentry(event: SentryEvent) -> SentryEvent:
prints("sentry event before send:", event.message)
# Process event and return either the same event object,
# with or withour modifications, or null to skip reporting the event.
if "App Hanging" in event.message and not report_app_hanging:
prints("skipping app hang event")
return null
elif "Mouse is not supported" in event.message:
# prevent irrelevant "Mouse is not supported by this display server." error on iOS
return null
return event```
then I tested this running in the Godot editor by triggering a divide-by-zero error. Breakpointing on the first print line, I saw that the event.message was empty (all other fields seem correct though). which means I cannot check the type of event. Furthermore, when I ran the game on iPhone through Xcode, nothing even got printed, even though I can see the issues that triggered coming through on the web. So seems like the before send callback isn't even happening on iOS.
HI @frozen coral Thanks for reaching out.
Normally, event.message is used in capture_message. The error message is stored in event.exception, which is not currently exposed. Recently, we've added API to access it, which should be out in the next version.
Actually, there are two PRs merged that are related to your issue. It will be released the coming week in 1.1.0 version.
One is increasing app hanging time to 5s, and the second one is accessing the error message in before_send:
Thanks, that's great news, I look forward to trying the new version. And I'm not sure if I made a mistake somewhere, but I am concerned that I didn't see the before_send callback firing on iOS, whereas I did through the editor - if you can just ensure this is functioning as well, I appreciate it. 🙌
Our tests rely on before_send, it should be working. There are some nuances with crash events. Like the event is actually sent on app restart on some platforms (Android and Apple).