News for hackers. Stuff that matters.
Re:You Can Throw() Anything in JavaScript – and Other Async/... by the_other on Friday April 08, 2022 @07:39AM (#30955722)
`throw` is a control flow instruction. Simply using it at all controls flow within your code. Are you suggesting never to use it?
Re:You Can Throw() Anything in JavaScript – and Other Async/... by smt88 on Friday April 08, 2022 @11:54AM (#30958800)
I am suggesting to use it to throw exceptions. This narrow purpose is subtly hinted at by its name.
Re:You Can Throw() Anything in JavaScript – and Other Async/... by the_other on Saturday April 09, 2022 @11:15AM (#30968747)
I don’t see how it’s hinted in the name. “Throwing an exception” is a phrase from within computing that exists because the feature exists in some languages, not because it came into programming from English.

There’s also nothing about “exception” that means “error”. If anything, modelling exceptions as errors is the anti-pattern. If you modelled all exceptions as descriptors, you could save Errors for when something actually goes wrong.

Honestly though, I’m employing Socratic argument. I am only defending this position to learn about the opposite.

Re:You Can Throw() Anything in JavaScript – and Other Async/... by golergka on Friday April 08, 2022 @08:27AM (#30956031)
I think that the parent comment means "for control flow unrelated to error conditions".