- 
                Notifications
    
You must be signed in to change notification settings  - Fork 31
 
          feat(server): Add captureException
          #313
        
          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
base: fix!/group-properties-structure
Are you sure you want to change the base?
  
    feat(server): Add captureException
  
  #313
              Conversation
| import com.posthog.PostHogInternal | ||
| 
               | 
          ||
| @PostHogInternal | ||
| public class ThrowableCoercer { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The instance of ThrowableCoercer that was in PostHog moved to PostHogStateless. Due to it being a protected variable, this scope has changed.
23e5be7    to
    55408ef      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved but pls address my comment.
| properties: Map<String, Any>?, | ||
| distinctId: String?, | ||
| ) { | ||
| shared.captureExceptionStateless(throwable, properties) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this include the distinctId? e.g.
shared.captureExceptionStateless(throwable, properties, distinctId)
Feels like you should have a test for this too, if one doesn't already exist.
| override fun captureException( | ||
| exception: Throwable, | ||
| properties: Map<String, Any>?, | ||
| distinctId: String?, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this also have similar params that a regular capture() call does? e.g userProperties, userPropertiesSetOnce and groups?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python does not have either
| 
               | 
          ||
| ## Exception Tracking | ||
| 
               | 
          ||
| PostHog provides automatic exception tracking to help you monitor and debug errors in your application. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| PostHog provides automatic exception tracking to help you monitor and debug errors in your application. | |
| PostHog provides manual exception tracking to help you monitor and debug errors in your application. | 
usually we say 'automatic' when we have autocapture support
| properties: Map<String, Any>?, | ||
| distinctId: String?, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| properties: Map<String, Any>?, | |
| distinctId: String?, | |
| distinctId: String?, | |
| properties: Map<String, Any>?, | 
just a nit, so it matches the capture method param ordering
| 
               | 
          ||
| var id = distinctId | ||
| if (id.isNullOrBlank()) { | ||
| exceptionProperties.set("\$process_person_profile", false) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we call hasPersonProcessing here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few comments/questions otherwise LGTM
3bb5b82    to
    886d3a2      
    Compare
  
    
💡 Motivation and Context
This change adds
captureExceptionto the server-side SDK andcaptureExceptionStatelessto core for error tracking capabilities. It does not implement auto-capture, as unhandled exceptions are typically already caught (or generally handled) by a server-side framework.Resolves #308
💚 How did you test it?
Added additional unit tests, updated the Java sample, and tested locally.
📝 Checklist