If I install an "onunhandledrejection" event handler that prints `e.reason.stack`, the "stack" only contains the error message; there's no actual trace. Can I get the trace somehow?
-
Show this thread
-
It seems like I can get it if I use Bluebird with "longStackTraces" enabled. Is using Bluebird in a new app a bad idea?
1 reply 0 retweets 3 likesShow this thread -
Oh, async/await always use native promises of course. Which means no solution that involves wrapping or any third-party promise library will work. Executing outside the main app's JS context is probably the only way to handle these errors properly. I dislike this.
3 replies 0 retweets 7 likesShow this thread -
Conclusion: there seems to be literally no way to execute some JavaScript code without promise rejection errors bubbling all the way up to the top of the execution context (window). And when they get to the top, there seems to be no way to tell where they came from.
6 replies 0 retweets 10 likesShow this thread -
Nothing is ever easy on the web.
2 replies 6 retweets 22 likesShow this thread -
I can't: - Overwrite Promise's constructor (async/await doesn't use it). - Use a third-party Promise library (same reason). - Use web workers (they can't access the DOM). I may be able to use iframes but I don't want to take that path now because it's a huge complication.
3 replies 0 retweets 5 likesShow this thread -
Instead, I'm going to try these heuristics to decide whether a rejection came from the user or not. They pass all of our existing error handling tests, plus some new ones that I wrote just to be sure. Even if it works, I will definitely be going to Computer Hell for this.pic.twitter.com/d1gpVZXVk5
5 replies 1 retweet 26 likesShow this thread -
Replying to @garybernhardt
Nah, this doesn't seem that bad given the situation. Pragmatism to balance concerns like these is always welcome. Reminds me of https://github.com/rust-lang/rust/blob/3dbade652ed8ebac70f903e01f51cd92c4e4302c/src/libstd/time.rs#L205-L241 …
1 reply 1 retweet 1 like -
Replying to @sgrif
Yeah, it's definitely the right decision at this point despite being gross. (But also I'm afraid that someone is going to show up and tell me to "just" run users' code in a web worker with their DOM manipulations transparently proxied across the worker boundary.)
1 reply 0 retweets 2 likes -
Replying to @garybernhardt
Hey have you considered just running the users code in a web worker?
1 reply 0 retweets 1 like
I'm sorry I'll go back in my box now
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.