Revert "removed try/except in main function"

This reverts commit 52da2df89db77c87b56a1bd48a8dbc7163206ca8.