Main - catch exceptions and print an error message prior to exiting.