News for hackers. Stuff that matters.
Re:It's probably time to stop recommending Clean Code (2020) by rglover on Tuesday May 25, 2021 @12:07PM (#27278596)
Check out the try/catch and logging pattern I use in the linked post. I added that specifically so I could identify where errors were ocurring without having to guess.

When I get the error in the console/browser, the path to the error is included for me like "[generatePasswordResetToken.setTokenOnUser] Must pass value to $set to perform an update."

With that, I know exactly where the error is ocurring and can jump straight into debugging it.

Re:It's probably time to stop recommending Clean Code (2020) by Merad on Tuesday May 25, 2021 @12:57PM (#27279301)
Good grief, that pattern looks like it's effectively building a stack trace by hand. Does node not provide stack traces with errors?
Re:It's probably time to stop recommending Clean Code (2020) by rglover on Tuesday May 25, 2021 @01:45PM (#27279901)
It provides a stack trace but it's often unintelligible. This makes the location of the error much clearer in complex code.
Re:It's probably time to stop recommending Clean Code (2020) by vidarh on Tuesday May 25, 2021 @01:08PM (#27279426)
Yeah, there really need to be a good reason to use catch(), and that's not it.