6 ms·
Perhaps a controversial opinion, but I think exceptions should only be thrown when something exceptional happens. Languages, like Java and Python, overuse them
by hgs3 3y ago
Perhaps a controversial opinion, but I think exceptions should only be thrown when something exceptional happens. Languages, like Java and Python, overuse them e.g. failing to open a file is not exceptional, but running out of memory is.
- pjmlp 3y agoRunning out of memory is an Error, not Exception, in Java's case, and the throw semantics are different.