DEV Community

Discussion on: Meme Monday

Collapse
 
sawyerwolfe profile image
Sawyer Wolfe

meme monday

Collapse
 
gamelord2011 profile image
Reid Burton

Simple:

try {
    //your bad code
} catch (error e) {
    console.log(e);
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
best_codes profile image
Best Codes • Edited

Try-catch basically gives you two options:

  • Wrap your whole code in try-catch, then you're back to the original problem of wondering where the error occurred
  • Use a ton of try-catches, which adds code complexity and is cluttered

Sometimes you can get a nice balance, but the point is that it shouldn't need to take extra steps to get detailed and actionable error information in a programming language.

Thread Thread
 
gamelord2011 profile image
Reid Burton

The second one is what I do when coding in C.

Collapse
 
htho profile image
Hauke T.

+1 for writing code that won't even parse

Thread Thread
 
rsteadman profile image
R Steadman

Gotta love people starting off with a variant of "actually it's simple" - be it about politics, economics, world events or programming, grab your popcorn because they're about to make a fool of themselves.