surround showErrorMsg with try catch