News for hackers. Stuff that matters.
Re:Current hardware trends make C++ exceptions harder to jus... by gumby on Tuesday February 22, 2022 @04:50PM (#30434387)
My experience in using exceptions (and restartable conditions) over the last 40 years is that exceptions are for things you don't have the ability or "knowledge" (i.e. state) to handle locally.

So a function that ingests a file and processes it may throw an exception if the file isn't found so that the UI can catch it and ask the user for an alternative filename (or to give up and not open a file at all).

If you're connecting to a remote machine and don't get a response, you might throw an exception because you don't know if the user typed the name wrong.

While if you are already talking to a machine and it stops responding it's reasonable to wait a moment and retry, as if could be a transient network brown-out which is something you can deal with on your own.

There are no comments on this comment yet.