boom icon indicating copy to clipboard operation
boom copied to clipboard

Manual notify exception

Open mcass19 opened this issue 2 years ago • 2 comments

This PR aims to implement the ability to manually send an exception. It's a first try so feel free to discuss / suggest whatever you want. Actually, there are a few things to discuss to set a direction to go.

To do / discuss

  • The manual exceptions are always sending an empty stacktrace for now
  • I added an extra check to see if we are on the router when defining handle_errors. I don't like it too much but I think it covers most of the cases (it doesn't cover if the user defines a module ending in .Router)
  • I changed the configuration so that it is read from the application environment, since now we can do use BoomNotifier anywhere and with the current implementation it would be necessary to always write it
    • But maybe the user wants different settings in different places or am I crazy?
    • Update tests if we keep this change
    • Update readme if we keep this change
  • Do we want to always send the conn object or do we want to be more open to any elixir code and just send the exception without much more information?
  • I defined a new manual_notify_error callback, but maybe it is better to have only one notify_error that handles all cases?

mcass19 avatar Jan 12 '22 14:01 mcass19

  • The manual exceptions are always sending an empty stacktrace for now

I think we can send (or teach the user to send) the stacktrace from the rescue block, using STACKTRACE/0.

jmbejar avatar Jan 17 '22 19:01 jmbejar

I changed the configuration so that it is read from the application environment, since now we can do use BoomNotifier anywhere and with the current implementation it would be necessary to always write it

  • But maybe the user wants different settings in different places or am I crazy?

I think it is fair to have a unique global configuration, so we have no other choice :)

jmbejar avatar Jan 17 '22 19:01 jmbejar