Java has/had a compiler check that forced you to write catch blocks or `throws` annotations in/on functions that call other functions which might throw.
The feature is called "checked exceptions" and I believe it has been discarded for its inconvenience by now.
Sometimes it feels like developers are going in circles while trying to find the most optimal way to handle errors.