Closed lkraav closed 4 years ago
I think this might boil down to simply using trigger_error()
manually, and _doing_it_wrong()
directly where appropriate.
I think you can look in this direction: https://github.com/stayallive/wp-sentry#capturing-handled-exceptions.
Except you might not have an exception so you want to capture a message: https://docs.sentry.io/error-reporting/capturing/?platform=php#capturing-messages
Trigger error would also work and that should also be captured, happy to take a look at your solution, it might be nice to add some more info to the docs if needed.
Exceptions: require extra try/catch ceremony dance
Messages: no backtrace, I think?
trigger_error()
-based approach seems like the optimal thing, at the moment.
Jep I think trigger_error
is the best and easiest.
Feel free to open up a PR if you feel this could be described better in the docs.
I'm staring at https://docs.sentry.io/error-reporting/capturing/?platform=php#capturing-events and as-is, it's surprisingly vague text:
Digging further, and started thinking maybe we should add some documentation in README.md on this.
For example, I'd like to
add_action update_option_rewrite_rules
to trigger a Sentry event, so I'd know as soon as someone is_doing_it_wrong()
.