stayallive / wp-sentry

A (unofficial) WordPress plugin reporting PHP and JavaScript errors to Sentry.
https://wordpress.org/plugins/wp-sentry-integration/
MIT License
300 stars 48 forks source link

Capture `console.error()` #141

Closed pinkasey closed 1 year ago

pinkasey commented 1 year ago

wp-sentry can register CaptureConsole to also report console.error().

This can be an optional feature, so that existing users of wp-sentry aren't surprised by new errors (although, I was surprised by the opposite - I thought Sentry tracks console.error() by default)

stayallive commented 1 year ago

Considering this requires another JS file to be loaded I'm not sure I'm willing to add this at this point since that would complicate our bundling and add yet another variant.

If you load the extra required JavaScript yourself you can already add the CaptureConsole integration if needed: https://github.com/stayallive/wp-sentry/tree/3df2aa2bd10a5b2fffbfa7fac282bad0f3c3266c#client-side-hook.

Would that also work?

pinkasey commented 1 year ago

Yes, I think that would work. Thanks.

Maybe it's worth documenting this in the README.md. I might open a PR for this if/when I do it myself.

stayallive commented 1 year ago

Sounds good 👍

I'll close this issue for now!