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

NS_ERROR_FAILURE with no line information, reproducible from a dataset #45

Open
danielquinn opened this issue Jun 23, 2015 · 3 comments

Comments

@danielquinn
Copy link

I have a dataset, a collection of tweets containing the word "climate" over a few hours. This dataset, when dumped into WordCloud renders a cloud alright, but the most used word never appears. In fact, a lot of words that shouldn't be in the top 10 are rendering very large. It also doesn't finish, dumping out an NS_ERROR_FAILURE in the console.

In an effort to make sure that only the most relevant words made it into the cloud, I sorted the array by the frequency value and chopped off everything but the first 500, 200, 100, and even 50 entries. The result in every case was that the word cloud doesn't even begin to render and just dumps NS_ERROR_FAILURE into the console from the start.

I've created a demo here if you'd like to see what's happening. Perhaps this is due to the fact that climate appears so often (obviously), but I'm unsure of how to modify the data set to play nice with WordCloud, or if this is indeed a bug.

@timdream
Copy link
Owner

timdream commented Jan 3, 2016

Sorry for the late reply. This is probably a bug in the browser (not being able to draw a word with the size of 11445!). I did see an error in the JS console in Firefox (NS_ERROR_FAILURE:) but it's not actionable since it does not contain any line or backtrace information.

Maybe we could find the real method that throws and wrap it with try {} catch {}?

@danielquinn
Copy link
Author

Hmm. I think that I was under the impression that the number wasn't the font-size but rather the "weight" of the word and that the Javascript would determine the font-size based on that. What you're saying makes sense though, so maybe something as simple as a check on each value to see if it exceeds 500 (or something else reasonable) would be appropriate?

For what it's worth though, I don't think it's the browser that's unable to render text at that size, but rather that the string requested can't fit on the canvas requested at that size. I base this assertion on the fact that I just used Firefox's dev tools to change the font on this page to 20000pt and while everything was HUGE, it didn't explode.

@timdream
Copy link
Owner

timdream commented Jan 4, 2016

Yes, the number is the weight but unless your weight factor is way smaller than 1 I assume 11445 means font-size > 11445px?

DOM rendering is quiet different than 2d canvas rendering, so the former works doesn't means the latter always works, unfortunately. You can refer to #14 and read the previous experiences. However, since the browser did not crash like it did in #14, we should be able to safely "workaround" it with a try ... catch block.

(It is also entirely possible my script did not pass the right parameters to the native code, so it throws at me)

All in all we need to find which call throws first.

@timdream timdream changed the title Sorting and shortening a dataset results in a crash NS_ERROR_FAILURE with no line information, reproducible from a dataset Jan 4, 2016
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

2 participants