Added `try` and `catch` around main application.