That's really the only proper solution for this problem.
Not necessarily the only proper solution--hard failure, like array out-of-bounds errors, is also often an acceptable solution.
That highly depends on the execution environment. In Erlang for instance that would be an acceptable solution. But most other environments don't deal nearly as gracefully with runtime errors.
MIPS on GCC defaulted to trapping integer overflows, but they had non trapping instructions too.