-
Notifications
You must be signed in to change notification settings - Fork 69
Make it optional to wrap jQuery or async callbacks #38
Conversation
See #35 |
Yes, as you can see I also linked to that bug in my pull request. However, that issue doesn't address the wrapping of native async calls, which also shouldn't be wrapped unconditionally. |
Whoa, I missed that. :) Sorry about that. What's your opposition against wrapping natives, just out of curiosity? |
We have our own wrapping of JQuery methods and async callbacks, which also use our custom error reporting and is used to run some code at the end of the run loop. TraceKit's methods get in the way of that, and it's unnecessary for us to have TraceKit wrap the methods since we already have the opportunity to wrap the necessary calls ourselves. We'd like to integrate TraceKit into our application with the least amount of impact, and all the global modificitions TraceKit does by default gets in the way of that. |
I tend to agree. (I'm not a part of TraceKit, FWIW) That's my largest gripe at the moment that TraceKit is too opinionated about what it does. I'd much rather have it as a library and stays out of the way until I tell it to do something. |
What we really want here is to be able to override a default handler from TraceKit. (You guys have your own, but other people don't want to deal with extra stuff like telling it to wrap jQuery and native methods) @pieter, do you think you could provide a code sample of what you do for the setInterval/setTimeout callbacks? The next version will use We need a 'lean' version of TraceKit where all it does is synchronous normalization, and then there can be an opinionated full-featured one, with a configurable build like jQuery. I think the simplest way to have a configurable build is simple inclusion/exclusion of files (like jQuery) .. I don't know how jQuery does this build thing, but I know with grunt we'll probably want to have the opening closure |
@devinrhode2 we have a wrapping framework, which wraps jQuery callbacks, setTimeouts, Ajax callbacks, mutationobserver callbacks and some other stuff. This generic module is then used by our own error handling (which we don't want to get rid of yet) and some modules that need to perform checks at the end of each runloop. The order in which these are wrapped is important: for example, we want the error handling to be performed around the end-of-runloop code. Inside our own error handler we try {} catch {} everything ourselves if it's not a development build, and then submit the captured exception to through Raven to TraceKit ( Basically, for our usecase, the only way we can use TraceKit is by passing on the exception ourselves. We won't be able to integrate it if it's going to add its own wrappers, since this would introduce too many changes. |
Are there any drawbacks to this code that would require you to still add your own try/catch blocks around all callbacks? If so, what are those drawbacks? Please detail and perhaps include code In the worst case scenario, you could no-op uncaughtException or make it undefined, and then the wrappers wouldn't do anything. |
Another approach that would be fine for us is something like this:
|
2 I don't know what you mean by 'missing one' 3 I would love your help with a list of native functions TraceKit should wrap, so we can cover all the native ones. If you want to help TraceKit by forking it and making a branch 'tracekit-lean' that would be extremely helpful. I'm thinking all this library should define is a |
I'm just trying to make sure we cover use cases for everyone. I'm pretty sure with the leaner version of TraceKit you won't have any problems. |
Hey, A lean version of TraceKit would be precisely what I'd need, and I think it could be useful for many more people. There can then be a more thorough version that installs wrappers etc. by default that could be used standalone, if you're just building a simple website. I'm not sure if I'll have the time to work on that though, but I'll take a look. |
I have at least sunday here, but I'm working on a more feature-ful version, and I'm not sure there would even be that much overlap. Disclaimer: I'm going to bed now so I won't be back online for at least 8-9 hours I'm thinking |
Can I close this now that #35 is merged? |
Well, #35 addresses the jQuery support but not the setTimeout / setInterval. Might be better to open a new issue to extract that functionality into a separate plugin though. Perhaps you can take a look at how you want to implement that, since a modular system goes a bit further than what this pull request implements. If you're ok with that, we can close this one. |
FYI this is moved into a /plugins folder in #49. |
Looks like this issue has been addressed and should be closed. |
@pieter , I'm helping manage the TraceKit project. Can you please create a pull request for this here https://github.com/csnover/TraceKit so we can get it merged in. |
@pieter, this is now fixed in the v0.2.0 release here: https://github.com/csnover/TraceKit |
I've made some changes around this in the root repo. |
We have our own wrapper for asynchronous callbacks and jquery events, where we do stuff beside exception handling.
TraceKit interferes with this by wrapping these threads too, even though we already catch exceptions in these async handlers ourselves.
TraceKits' wrapping should be optional, so it doesn't interfere with wrappers you create yourself.
This patch disables the wrapping of both setTimeout & friends and jQuery entirely. They can be re-enabled by calling TraceKit.wrapJQuery() or TraceKit.wrapAsyncCallbacks().
Refers to #35.