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

Add centralized error handling for the patching process #35

Open
jackhorton opened this issue Aug 7, 2017 · 0 comments
Open

Add centralized error handling for the patching process #35

jackhorton opened this issue Aug 7, 2017 · 0 comments

Comments

@jackhorton
Copy link
Member

There are a bunch of different ways that patching can fail, and different levels of severity for any given patch failure:

  1. A patched function may throw due to errors introduced by the patch
  2. A patched function may throw due to errors that the patch checks for and simply forwards along to the patchee.
  3. A patched callback/event handler may throw itself
  4. A patched callback/event handler may call an original callback/event handler that throws

When the original library throws or when the user-supplied callback or event handler throws, this may be caused either by the user supplying known-invalid arguments or by a patch making incorrect changes to the user-supplied arguments.

Regardless, we should likely have a way to track these errors. Some initial notes on that:

  • We probably want to report what argument configuration caused this error to come up, but we definitely don't want to actually give all of the arguments themselves for security reasons. Perhaps we can track the types of arguments provided as a middle ground? Or, we could log everything and let the channel user decide what to do for security depending on their use case.
  • Errors coming from user-supplied callbacks and original libraries could be completely not our fault, but determining when that's the case is tough.
  • We could publish them all over a dedicated channel: channel.publish("patch-error", { err: Error, severity: number, arguments: any[]}
  • We could provide an API to hook into: channel.throw() /* from the publisher */ -> channel.catch() /* from the subscriber */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant