Skip to content
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

Register custom handlers for exceptions #15

Open
brendanlong opened this issue Jan 31, 2019 · 0 comments
Open

Register custom handlers for exceptions #15

brendanlong opened this issue Jan 31, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@brendanlong
Copy link
Contributor

Some OCaml exceptions have special information which we would like to represent in Sentry in ways besides as an sexp string. For example, Async has monitor.Error, which contains a much more useful backtrace in Async code, exceptions thrown by Error.t sometimes also contain backtraces, and other exceptions could probably be parsed into an exception type + title + description instead of merging all of that into a sexp.

An example interface (a not particularly efficient one) is something like:

val register_exn_converter : exn -> Sentry.Exception.t option
let () =
  register_exn_converter (function
     | My_custom_exception (title, description) -> Some ...
     | _ -> None)

Then we could iterate over all of these until we get a Some result, and fall back to sexp version if necessary. We probably also want to expose the default version so implementers can use that, then just override the parts they can do better.

If we do this, we can remove the custom logic for montitor.Error and Error.t and just register converters for them by default.

@brendanlong brendanlong added the enhancement New feature or request label Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant