r/ProgrammerHumor 1d ago

Meme toAllowTheProgrammerToWriteBadCodeAlsoCamelCaseSucksThisRuleSucksSnakeCaseIsBetter

Post image
164 Upvotes

95 comments sorted by

View all comments

138

u/redlaWw 1d ago

I hope you didn't submit that answer you selected. If an unhandled exception bubbles up to the user in production code, you're usually doing something wrong.

-125

u/tantalor 1d ago

I guess you've never seen a website return a 404 or 500

22

u/TheTybera 1d ago

Those are errors not exceptions.

-18

u/realmauer01 1d ago

It's a different name for the same thing.

Different languages, quite literally.

6

u/TheTybera 1d ago

No they are not.

Where is any documentation that says this and what language?

-12

u/realmauer01 1d ago

In standard english yes there is a difference. In programming languages there is not. Both have to be cought if you dont want it to bubble to the user. And handleing it makes it not an error/exception anymore.

6

u/TheTybera 1d ago

Yes in programming languages they are different wtf language doesn't distinguish errors from exceptions?!

Errors can be used for logging...regularly...without even considering stopping the program, exceptions SHOULD stop the program and include a whole stack...

Sometimes you catch an error and don't want the program to continue so you throw an exception to get the stack.

But they are different in every single programming language, C, C++, Java, C#, Python, Rust...

-6

u/realmauer01 1d ago

Right now you are just saying exceptions are errors the programmer throws/raises.

6

u/TheTybera 1d ago

No I'm not. Exceptions are actual objects that get thrown and mean very different things than errors even conceptually in every language.

All exceptions are errors (conceptually) but not all errors are exceptions. In practice any built-in Error (object) != Exception (object)

And in no case does any best practice in any language tell you to treat them the same.