Skip to content

0.8.0 throws exception if setUserContext called without email, userID, or username #45

@jpaas

Description

@jpaas

This may be working as intended, but its definitely new as of 0.8.0. Whenever I call setUserContext, I now have to pass an object that contains members for email, userId, and username, otherwise I get a native exception like this:

05-10 14:44:16.952 9632-21806/com.karmacasting E/unknown:React: Exception in native call
                                                                com.facebook.react.bridge.NoSuchKeyException: couldn't find key email in dynamic object
                                                                    at com.facebook.react.bridge.ReadableNativeMap.getString(Native Method)
                                                                    at io.sentry.RNSentryModule.setUser(RNSentryModule.java:93)
                                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                                    at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:368)
                                                                    at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:138)
                                                                    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                                    at android.os.Handler.handleCallback(Handler.java:739)
                                                                    at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                                    at android.os.Looper.loop(Looper.java:148)
                                                                    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:208)
                                                                    at java.lang.Thread.run(Thread.java:818)

I used to be able to call Sentry.setUserContext({}) to clear the context, but now I have to call:

      Sentry.setUserContext({
        email: null,
        userID: null,
        username: null
      })

Not a big deal, but just saying.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions