Surrounds the sub handler with a try-catch.

In case it would crash, just log the error instead of crashing the application.