Hacker News new | ask | show | jobs
by rune-dev 34 days ago
This is a poor implementation not a framework problem lol.
1 comments

> This is a poor implementation not a framework problem lol.

I've seen literally pixel-identical error messages taking over the entire screen when there is a JS error, in exactly that way, across countless of websites. If it's not a framework, it's a library in wide use, because tons of websites have exactly the same issue.

It’s a generic error screen from a framework yes.

But the cause of the error is a poor implementation from the developer.

I can write code that errors out in <insert your favorite language here> does that mean it’s bad?

Read the context first. Initially, we had HTML + JS pages where one function can have one error, and the page keeps on working, because the error didn't block the entire screen.

Now we have some popular framework/library that instead seems to surface these errors that aren't sitting in the top-level scope of the JS application, yet the errors ends up blocking the entire application.

That means it's bad, yes. And it's not any language, we're specifically talking about JS in browsers here.

Modern JS frameworks can absolutely catch and isolate errors. In those cases you’d only see the error in the specific component that had the error. Or if they’re a good dev you as a user won’t even know! You’ll see fallback content.

An error blocking the full screen is a failure on the developer not the tools.

> An error blocking the full screen is a failure on the developer not the tools.

I don't see how this is possible, given that the default experience with HTML and JavaScript isn't "Tear down the entire page to display an error", but something that's seemingly becoming more and more common to actually come across. Guess I need to chase down what library/framework this is coming from, since seemingly I'm not able to describe the issue properly.

You don't need the "modern JS framerwork" to "catch and isolate errors" because that's a feature JavaScript comes with by default in browsers! You literally have to add code to make it worse, which seems to be happening in some framework/library.

If you're manually adding logic for doing "error in component doesn't break entire application" then you're already working against what the environment gives you by default for free.