aptabase / aptabase-swift

Swift SDK for Aptabase: Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps
https://aptabase.com
MIT License
23 stars 8 forks source link

Closure in Aptabase.trackEvent #3

Closed bircni closed 1 year ago

bircni commented 1 year ago

Hi I am just getting an error from track Event

Bildschirmfoto 2023-06-10 um 09 49 47 Bildschirmfoto 2023-06-10 um 09 50 12
goenning commented 1 year ago

Is it easy to reproduce? Any example of how to cause this exception?

bircni commented 1 year ago

Unfortunately not... Cannot reproduce it again 🥲 An error was catched and I tried to log it via Aptabase

goenning commented 1 year ago

have you tried logging an error like this or something similar?

                do {
                    // something that throws an error
                } catch {
                    Aptabase.shared.trackEvent("catch_error", with: ["error": error])
                }

If so, you could try using error.localizedDescription instead because the dict with custom props only accepts strings and numbers.

But it shouldn't crash though, I'll have a look at why that happens

goenning commented 1 year ago

@bircni try updating to 0.1.0, I changed the trackEvent signature to be more explicit with what types it accepts: Strings, Int, Float, etc. Anything else should throw a compilation error instead of failing during runtime.

bircni commented 1 year ago

Thanks!