Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Voxera115731yWhy?
Having literally a “ignore errors” syntax just invites even worse code.
You can still do it with an empty catch but then its at least a bit more obvious your doing it.
Even when its relevant I would still want the catch to have some comment on why you have no error handling. -
lopu8841yJust when debugging it's annoying when debugging SSR react apps having to add a catch block when you're just debugging window usages
-
lopu8841yAnd if you use eslint you have to add // ignore or nothing as a comment in the catch block just to stop the empty block error..
-
Kotlin library like ArrowJS could be what you're looking for, maybe sth like that exists in JavaScript, too?
https://arrow-kt.io/learn/... -
Voxera115731y@lopu and that is a good thing.
Old vbscript had an “on error resume” statement that just ignored errors and it was a dumpster fire solution resulting in so many invisible problems.
Forcing you to be explicit with ignoring is good.
Also? That empty catch, is a good place for a break point :)
Having used js since its inception back in netscape 2 I see no reason to make it easier to ignore errors, I would even want it to enforce a real statement in the catch making it even more annoying to ignore errors. -
yes please.
This language is a shitshow already, just mess it up more, until it's unusable.
Don't forget to also throw in goto and make whitespaces optional. -
It does!!
They are used by default, so you don't even have to write `try {alert();}` - instead you can write a shorthand: `alert()`
Related Rants
Javascript should have try blocks without the need for catch or finally....... IMO
rant
js