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

Reload uncaughtException plugin if enableUncaught changes, same with unhandledRejection #1163

Closed
5 tasks done
BethanyBerkowitz opened this issue Aug 14, 2023 · 3 comments
Closed
5 tasks done
Assignees
Labels
js @honeybadger-io/js

Comments

@BethanyBerkowitz
Copy link
Contributor

BethanyBerkowitz commented Aug 14, 2023

See #1161 (comment).

Currently, the listeners for uncaughtException and unhandledRejection are only added if the corresponding setting is true. Then the listener decides not to report if the user later changes the setting to false. This is reasonable, but inconsistent because if the user sets up Honeybadger with the setting off, then later flips it to true, the plugin will not be reloaded and the listener will never be attached.

We prefer to reload the plugin if enableUncaught changes. (ie remove the listener if the value is set to false and add it if it's set to true). Same deal with enableUnhandledRejection.

@subzero10
Copy link
Member

reload the plugins when the corresponding config option changes (core package)

Have you thought about this? What if we added a property on the Plugin type, such as shouldReloadOnConfigChange or something like it?

@BethanyBerkowitz
Copy link
Contributor Author

reload the plugins when the corresponding config option changes (core package)

Have you thought about this? What if we added a property on the Plugin type, such as shouldReloadOnConfigChange or something like it?

Yes, that's what I was thinking! Just a boolean (default false) for whether to reload or not.

Another option would be to add an array of config keys that should cause a reload. We'd load everything the first time (ie when __pluginsExecuted is false. Then reload only if one of the designated keys was passed in to the configure() function. This would be more complex and I doubt that users are calling configure() all that often... so it seems like maybe over-optimizing.

@subzero10
Copy link
Member

Just a boolean (default false) for whether to reload or not.

I would prefer this option over the other, simply because we are letting the plugin itself decide whether it should be reloaded or not. Having a an array of config keys could be easily forgotten when updating or creating a plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
js @honeybadger-io/js
Projects
None yet
Development

No branches or pull requests

2 participants