Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Allow to define a custom culprit in opbeat.captureError() #20

Closed
FdezRomero opened this issue May 15, 2015 · 4 comments
Closed

Allow to define a custom culprit in opbeat.captureError() #20

FdezRomero opened this issue May 15, 2015 · 4 comments

Comments

@FdezRomero
Copy link

Hi there!

I was trying to send a different culprit to Opbeat to better group our custom errors (we can always check for function and filename below in the stacktrace) but I noticed that the module always overrides our options.culprit.

Could you add a simple check not to force calling to setCulprit() in lib/parsers.js when one is already specified?

I was going to write a pull request but I'm not sure how you guys prefer to do this ;-)

Thanks!

@watson
Copy link
Member

watson commented May 16, 2015

@FdezRomero good idea. I've just released v1.4.0 which now allows you to overwrite the culprit

@watson watson closed this as completed May 16, 2015
@FdezRomero
Copy link
Author

Thanks @watson! You were superfast ;-)

@FdezRomero
Copy link
Author

Hi @watson, I was checking some errors I sent with the custom culprit to Opbeat but they are showing with none in the web (I just see the error group number). I'm sending them like opbeat.captureError(err, { culprit: 'This is the culprit', extra: { url: some_url } });. In the detail page of the error group it says "No culprit available".

Am I doing something wrong?

Thanks.

@watson
Copy link
Member

watson commented May 24, 2015

@FdezRomero In your case I think the issue is related to that err is not an Error object but possibly just a string - am I right? There is a bug in v1.4.0 that means that if you just give a string to captureError instead of an Error object, then it will ignore your custom culprit. This have been fixed in v1.4.1.

But after re-reading your original issue, I see that you are trying to use the culprit to control the grouping inside Opbeat. Unfortunately the culprit is not used to group the errors. Instead I would suggest that you use a custom Error object. You can make your own an call then FooError and BarError or use the default JavaScript error types - each type will then be grouped independently.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants